#development

1 messages · Page 1408 of 1

median vector
#

I think

#

Lemme check the docs

#

Yes I fixed it

#

So if you use discord.py with the commands extension then you can do something like:

@bot.command()
async def mycommand (ctx, channel: discord.TextChannel):
    await ctx.send("Channel ID is "+str(channel.id))
#

@drifting wedge ^

#

Also nice discriminator

drifting wedge
#

69 gang

#

I figured it out

#

It was 2:20

#

Yep ty

delicate shore
#

What else we can do

#

Instead of a function

#

in module.export

#

what are other things

#

Like I have a thing
cat: function cat () {}
So person has to do api.cat()
Is there any way he just do api.cat

delicate shore
#

Thank you so much @cinder patio

#

I figured it out

abstract perch
#

Heyy, so, I would like to have two not just one (awaitMessages actions). So the bot asks you for something, then it collects your response. But if I want to have another await Message action it will straight go there without waiting for me to response the old question.

Here's an example:

#

Like, is there a way to set different parameters for both of them and have an await action between them?

#
message.channel.send('What title?')
            .then(function () {
            message.channel.awaitMessages(response => message.content, {
                    max: 1,
                    time: 3000,
                    errors: ['time'],
                }).then(function () {
                    message.channel.send('What Description')
                    message.channel.awaitMessages(response => message.content, {
                            max: 1,
                            time: 3000,
                            errors: ['time'],
                        })
                        
                    });
            });
delicate shore
#

You can also use some npm packages

#

I find that easy

abstract perch
#

Really? Hm

earnest phoenix
#

@abstract perch You don't have to create different awaitReactions or whatever

#

You should use a Message Collector

abstract perch
#

Tried that but didn't have any luck

earnest phoenix
#

And iterate through every question

abstract perch
#

Probably I am doing it the wrong way

earnest phoenix
#

Want me to show you an example?

abstract perch
#
channel.awaitMessages(filter, { max: 4, time: 60000, errors: ['time'] })
  .then(collected => console.log(collected.size))
  .catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));```
#

You mean that?

earnest phoenix
#

Nah

abstract perch
#

Oh

#

If you could, go ahead 🙂

#

I will be more than happy

#

I will be here so do not worry, I am not leaving

delicate shore
#

how to return an array

#
chuckjoke: function chuckjoke() {
        try {

            fetch("https://api.chucknorris.io/jokes/random")
                .then(res => res.json())
                .then(json => {
return json
                })

    } catch (err) {
            throw new Error("An error occurred , error: " + err);
        }
    },```
#

it returns undefined

queen needle
#

return <array>?

delicate shore
#

not an array

#

tbh

#

Like

#

see the code

queen needle
#

try

#

give me a minute

delicate shore
#

k

#

fetch is node-fetch

#

jsyk

earnest phoenix
#
let questions = ["What title?", "What description?", "What BOTTOM TEXT?"], asked = 0, mainMessage = await message.channel.send(questions[asked]);
let collector = message.channel.createMessageCollector(m => m.author.id === message.author.id);
let timeout = setTimeout(async () => {
if (asked !== (asked + 1)) {
await collector.stop();
return message.channel.send("It took you too long to answer my question.");
} else {
// Nothing
}
}, 30000);

collector.on("collect", async collectedMessage => {
questions[asked] = {
asked: questions[asked],
response: collectedMessage.content
};
if (asked === questions.length - 1) {
await collector.stop();
return clearTimeout(timeout);
}
asked += 1;
clearTimeout(timeout);
timeout = setTimeout(async () => {
if (asked !== (asked + 1)) {
await collector.stop();
return message.channel.send("It took you too long to answer my question.");
} else {
// Nothing
}
}, 30000);
await message.channel.send(questions[asked]);
});

collector.on("end", () => {
// Do whatever with the responses they're in 'questions' and there you go
});``` this is just a simple one yet
#

@abstract perch

abstract perch
#

Wow, thank you bro

queen needle
#

so its a json object which is a promise

delicate shore
#

So i need to resolve it ?

abstract perch
#

@earnest phoenix Would like to thank you so much mate. I would let you know how it goes

earnest phoenix
#

Np

queen needle
#

hm i might be wrong

#

ik if you log json it logs the object correctl

delicate shore
abstract perch
#

I will in a sec

delicate shore
#

k

delicate shore
abstract perch
#

So I can separate every answer?

delicate shore
#

SyntaxError: Illegal return statement

#

I returned a promise

#

or did I

#

return new Promise(resolve  => {
 fetch("https://api.chucknorris.io/jokes/random ")
 .then(res => res.json())
 .then(json => {
  resolve(json)
                })

        })```
I did some random shit
#

soooo

abstract perch
#

@earnest phoenix Idk if that would be possible actually

earnest phoenix
#

The questions?

abstract perch
#

Yeah, like separate the answers with parameters

#

so i can make a custom embed

pale vessel
#

@delicate shore Where did you put that

earnest phoenix
#

"seperate the answers with parameters" what params

abstract perch
#

with arguments

delicate shore
pale vessel
#

Can you show the file

delicate shore
#

ok

earnest phoenix
delicate shore
#
module.exports = {
    cnjoke: function cnjoke() {
// code
    },
    joke: function joke() {
       // code
    },```
earnest phoenix
#

<I said bruh 3 times don't worry>

delicate shore
#

this is how I am doing all

earnest phoenix
#

@delicate shore What are you trying to do?

delicate shore
#

return a joke

pale vessel
#

Why not make it an async function and use await

abstract perch
#

Hm let me see

queen needle
#

^^ i did some backwards thing to get the function working one of them would be more of a help to you

earnest phoenix
#

Both returns a promise so not making the function async would be a bruh moment

delicate shore
#

same error

earnest phoenix
#

What's the error

queen needle
#

what exactly did you try tho

delicate shore
#

Wanna see the code

pale vessel
#

Can you show the whole code lol

delicate shore
#

  let res = await fetch("https://api.chucknorris.io/jokes/random")
let json = await res.json()                
return json```
#

I tried this as well

pale vessel
#

res.json()

delicate shore
#

Yes

pale vessel
#

and return json

#

Oh same thing

delicate shore
#

ok

#

it was a typo anyway

hazy sparrow
#

How do i make it that if someone presses a reaction the bot does somehing? Is there a event for that or what? D.js v12

earnest phoenix
#

Use reaction collectors

pale vessel
#

I would use ```js
module.exports = {
cnjoke: async () => {
const res = await fetch("https://api.chucknorris.io/jokes/random");
const json = await res.json();
return json;
}
};

// some other file
const functions = require("script.js");
const joke = await functions.cnjoke();

abstract perch
#

@earnest phoenix I am trying to make an embed builder so you do ?embed then you answer every question and then every response will have its own argument/parameter and it will be placed inside a different ${bracket}

#

Like, collecting the answers and placing them in different places into an embed

earnest phoenix
#

Then, build the embed on whatever i showed in the end event and map through them by placing it in the embed wherever you want

pale vessel
#

@delicate shore or instead of using files you can use a one line code const joke = await (await fetch("https://api.chucknorris.io/jokes/random")).json();

delicate shore
#

Oh ok

#

Thanks

delicate shore
#

joke: async function joke(){}

#

and it's working

#

as well

#
const insulter = require('insult');

insult: function insult() {
        try {
            insulter.Insult();
        } catch (err) {
            throw new Error("An error occurred , error: " + err);
        }
    }```
#

My code

#

my error

random pagoda
#

how can i add commands to my bot

rustic nova
#

with code

pale vessel
#

commands.add(commandName[, callback])

delicate shore
#

i dont even use await

earnest phoenix
#

make a sacrifice to discord gods

pale vessel
#

you need to give them 5 nitro offering

#

Non-classic

earnest phoenix
#

It didn't place the footer because the raw data isn't actually called footer

abstract perch
#

yeah

earnest phoenix
#

Which the function you used did use await inside it but it isn't an async function

earnest phoenix
#

Then you can build the embed with it, i just rewrote the last part of what i already sent

#
collector.on("end", () => message.channel.send({
embed: questions.reduce((acc, current) => (acc[current.asked.split(" ")[1].slice(0, -1)] = current.response, acc), {})
}));```
abstract perch
#

oh

random pagoda
#

what programs do you use

abstract perch
#

that's weird hm

rustic nova
#

IntelliJ IDEA, DataGrip

abstract perch
#

kk wait

earnest phoenix
#

Waiting for JavaScript syntax highlighting for codeblocks in discord mobile to be added be like

rustic nova
#

they do have it on the alpha version of discord mobile i think

#

that stuff you have to apply for

abstract perch
#

The format is kind of weird

#

like, how can I define what's title and what's the description?

earnest phoenix
#

At least the regular and the beta build has it but only for 5 languages

#

Python, XML, Rust, Kotlin and ProtoBuff

delicate shore
#

I got an error

#

await is only valid in async function

#
insult: async () => {
        try {
            return new Promise(resolve  => {
          let jokee = await  insulter.Insult();
            resolve(jokee)
        })} catch (err) {
            throw new Error("An error occurred , error: " + err);
        }
    },```
#

I am using code suggested by flap

earnest phoenix
#

resolve is a callback function

#

Which must also be async

delicate shore
#

oh

#

OH

#

DAMN

#

Like this ?

earnest phoenix
#

Tf

delicate shore
#

async Promise

#

or something

earnest phoenix
#
{
insult: async () => {
try {
return new Promise(async resolve => {
let joke = await insulter.Insult();
return resolve(joke);
});
} catch (err) {
throw new Error("An error occurred, error: " + err);
}
}
}```
delicate shore
#

thanks boi

sudden geyser
#
try {
  await insult()
} catch (ex) {
  insulter.kill()
}```
earnest phoenix
#

That's what i call moments before disaster

abstract perch
#

Yeah, can't get it to work properly, the format is way to weird

#

the embed I mean.

#

Like, I can't define which is a title and which is a desc

earnest phoenix
#

You define them, by questions

abstract perch
#

embed: questions.reduce((acc, current) => (acc[current.asked.split(" ")[1].slice(0, -1)] = current.response, acc), {})

earnest phoenix
#

What title? becomes title, with that i just wrote

#

Yea with that

abstract perch
#

No, it takes the desc as a title

#

or no

#

no

#

sorry

#

Let's say I want to add the last one

earnest phoenix
#

The last one?

abstract perch
#

Yeah

#

What BOTTOM TEXT?

earnest phoenix
#

What do you mean by that

#

Oh yea

#

I meant that as a joke but it should be footer, you should predefine some of the properties which the properties of the questions are supposed to be inside that pre-defined property

#

Because footer is supposed to be an object

pale vessel
#

I see

earnest phoenix
#

Or if you want, you could just pre define all the methods that should be used for a embed property like

// Questions
let questions = [
{
question: "What title?",
response: "",
method: Discord.MessageEmbed.prototype.setTitle
},
{
question: "What description?",
response: "",
method: Discord.MessageEmbed.prototype.setDescription
},
{
question: "What footer?",
response: "",
method: Discord.MessageEmbed.prototype.setFooter
}
];

// After the collector finished

let embed = new Discord.MessageEmbed();
questions[0].method.bind(embed)(questions[0].response);
// And so on

message.channel.send(embed);```
delicate shore
#

How can I add a cool down

#

Or rate limit

#

In my npm package

unborn ridge
#

can i get help plsssssssssss

#

i request plsssssssss

crimson vapor
#

don't ask to ask

#

just ask

unborn ridge
#

i want to make subfolder in a folder

#

i dont know how to do that

crimson vapor
#

could you not just make a folder in the dir?

#

or just make the folder the same way you make a normal folder

unborn ridge
#

i wanted to make in commands folder

#

different folders like admin general

#

i didnt made any subfolder in my previous bot and that was headache

crimson vapor
#

do you mean getting the commands to register?

#

or actually making the folder

unborn ridge
#

i want to register command in subfolder to be registered

crimson vapor
#

how do you register commands rn?

restive furnace
#

just go all the directories and ez

unborn ridge
#

👀

#

how

#

@restive furnace

crimson vapor
#

how do you register them now?

unborn ridge
#
  if(err) console.log(err);
  let jsfiles = files.filter(f=> f.split(".").pop() === "js");
  
  if(jsfiles.length <= 0) {
    console.log(`NO COMMANDS FOUND !`);
  }

console.log(`LOADING ${jsfiles.length} COMMANDS !`);

jsfiles.forEach((f,i)=>{
  let sss = require(`./commands/${f}`);
  console.log(`${i+1}: ${f} Has Been Loaded !`);  
  bot.commands.set(sss.help.name,sss)
})
})```
delicate shore
#

How can I add a cool down

#

Or rate limit

#

In my npm package

unborn ridge
#

no idea

#

where aalllll gone

#

ughhh

crimson vapor
#

just make a function

restive furnace
#

just check if the file doesn't end with .js and if so, rerun the function 😯

crimson vapor
#

and

#

well

#

I would make a function and for every file check if it is a folder, if it is, run the function again with the subdir

delicate shore
#

Pls answer me

#

How can I add a cool down or rate limit

#

In my npm package

pure lion
#

@delicate shore add a map, make it set to the map with the channel/user ID and the value being Date.now() + <your rate limit in milliseconds> now check if then Date.now() is greater than or equal to the rate limit and return if it isn't

delicate shore
#

It's a npm package

#

I can't add channel/user ID

pure lion
#

What's the npm package being used for?

delicate shore
#

Getting jokes, insults , images

#

Etc

pure lion
#

Ah

delicate shore
#

`api.joke() // Returns a dad joke

api.cnjoke() // Returns a cn joke

api.devjoke() // Returns a dev joke

api.insult() // returns a random insult

api.vase() // returns a vase image

api.cat() // returns a cat image

api.dog() // returns a dog image

api.duck() // returns a duck image

`

#

These all

#

Till now

pure lion
#

Then do what I just said but don't do a map, instead have a rateLimit variable and make it do the stuff I just mentioned without the map

delicate shore
#

..........
How will I get user ID

#

Or channel ID

pure lion
#

I just said no map

delicate shore
#

It has nothing to do with discord

pure lion
#

Yes

#

No map

#

Only rate limit

delicate shore
#

What to store in rate Limit variable

pure lion
#

Have it in the package

delicate shore
#

What ?

#

Have it in the package ?

#

Means ?

#

Ok one thing

unborn ridge
#
embed.image.url: Could not interpret "{}" as string.
    at RequestHandler.execute (C:\Users\Krishan Kumar\Desktop\oggy bot\f\node_modules\discord.js\src\rest\RequestHandler.js:170:25)```
#
const client = require('nekos.life');
const Discord = require('discord.js')
const neko = new client();
module.exports.help = { 
    name: "hug",
  
}
module.exports.run = async (bot, message, args) =>  {
    const embed = new Discord.MessageEmbed()
    .setTitle('SOME NEKOS.LIFE STUFF')
    .setImage(neko.sfw.hug())
     message.channel.send(embed)
     

}```
#

?

#

plssssssssssss

#

@crimson vapor

pure lion
#

@delicate shore when youw rite the package, put the rateLimit in a file

#

Like make it a function

#

Every time the bot is written to, call setRateLimit

vocal sluice
#

how do i assign a variable to a number?

slender thistle
#

??

pure lion
#

@vocal sluice le what

earnest phoenix
#

how do i run tasks not on startup?
for example if it prints a message every 5 secs
it prints it 5 secs after it starts
not as soon as it starts
discord.py fyi

#

because they are defaulted to start on_ready

#

Arent they uhh

#

Pause method on python

pure lion
#

Don't call them on_ready then nekohuh

earnest phoenix
sick fable
#

I coded one code which created maximum channel as it can

#

It's for my test server

earnest phoenix
#

Not a good idea

pure lion
#

Keep it outside of your on ready event

sick fable
#

Whenever I coded that command , it isn't making those channels

rustic nova
#

There's something called Ratelimits Sparkles

earnest phoenix
#

Would suggest that you dont do that

rustic nova
#

these are there to prevent people like you do bad bad thing with discords api

sick fable
#

Ok

devout mortar
#

hello

rustic nova
#

Hey

#

need anything?

devout mortar
#

how to make a music command at my bot?

rustic nova
#

discord.js i assume?

devout mortar
#

yes I know, but with discord.js how do we do it?

#

?

rustic nova
devout mortar
#

I speak very bad English sorry

rustic nova
#

what language to you speak?

devout mortar
#

French

rustic nova
#

Je vous suggère de consulter les tutoriels sur la manière de le faire. Ou attendez quelqu'un qui pourrait vous aider avec les js, car je n'ai pas d'expérience dans ce domaine.

devout mortar
#

daccord, jai un ami qui sy connais je vais lui demander

rustic nova
#

Cela semble être une bonne idée, bonne chance !

mighty gorge
#

I’m a dev B)

rustic nova
#

so am i Cool

pure lion
#

Me 3

#

Learning langum number 7 nekohuh

carmine summit
#

How can I make something like:

let prefix = '@everyone'
if (!/(prefix)\w/.test(message.content)) return
pure lion
#

You don't

carmine summit
#

then how can I make something that the bot will run only if its the prefix then a letter after the prefix

pure lion
#

slice the content by 0 and the prefix.length + 1

carmine summit
#

that works aswell

pure lion
#

Gg

hazy sparrow
#

Am i doing something wrong?

const ms = require ("ms")
const Discord = require("discord.js")
const client = new Discord.Client();
module.exports = {
   name: 'ping',
   description: "this is a ping command!",
   
   execute(message){
       message.channel.send("Pinging...").then(m => {
           let ping = m.createdTimeStamp - message.createdTimeStamp
           
           m.edit(`pong! (${ping}ms)`)
       })
    
       
       
   }
}
carmine summit
#

you didnt defing m

#

wait

#

nvm

#

Timestamp instead of TimeStamp

pure lion
#

^

#

Aifjao

hazy sparrow
#

im dum

devout mortar
#

re

#

ya problème dans le statut de mon bot, jai re entré un nouveau statut mais lancien veux pas seffacer

#

c avec bot désigner

rustic nova
#

Vous faites probablement tourner le robot deux fois

#

Attendez un peu et voyez si quelque chose change

devout mortar
#

daccord

#

merci

rough knot
#

Anyone know how to use better-sqlite3 as a database?

earnest phoenix
#

Which Database Do You Use Right Now?

rough knot
#

None

earnest phoenix
#

yo any advice as to creating a kill feed
im new to the code world... just looking to be pointed in the right direction

rough knot
#

But i want to use better-sqlite3 @earnest phoenix

earnest phoenix
#

quick.db wio.db

rough knot
#

?

#

I want to use node.js better-sqlite3

earnest phoenix
#

Sorry I did not read

rough knot
#

its ok

harsh blade
#

Yo uh, how do i save files in micro?

tribal siren
#

you don't

delicate shore
#

oh ok

earnest phoenix
#

anyone know the length of a rate limit?

#

for discord

#

because i think my bot got stuffed from it

#

i am getting no errors its just not turning on

#

djs

rustic nova
earnest phoenix
#

hmm

#

ok i just tried with a different bot token and it works

#

so i think i did get rate limited

ionic silo
#

how to make discord bot leave a voice channel?

earnest phoenix
#

js?

ionic silo
#

yup

rustic nova
#

your bot probably got quarantined

rough knot
#

So i have config.json i want to acces trough command handler and i use this ("../config.json")

#

But it cant find it

#
const Database = require("better-sqlite3")
const db = new Database("../db.txt")``` The code i use in that file
summer acorn
#

currently trying to download backups of my mongodb before uninstalling to reinstall, but I can't access them because missing permissions, so I chowned, and I did ls -l but it's still root

earnest phoenix
summer acorn
#

I managed to fix the permissions by adding /* at the end of the chown command

tribal siren
#

ping me if you get a discord.js problem

#

im bored

summer acorn
earnest phoenix
#

you work in cmd?

#

I don't know

#

sorry

delicate shore
#

hoi

#

heyy

#

Can you suggest some functions i should add in my api
It has currently these

api.cnjoke() // Returns a cn joke
api.devjoke() // Returns a dev joke
api.insult() // returns a random insult 
api.vase() // returns a vase image 
api.cat() // returns a cat image 
api.dog() // returns a dog image 
api.duck() // returns a duck image```
Any suggestions?
tardy hornet
#

@delicate shore i don't have any suggestion but i just wanted to say that i really like your logo

delicate shore
#

Thanks

#

Your too

tardy hornet
#

lol pfffffff mine is ugly

delicate shore
#

nah

#

it's attached to me

#

I lost one yesterday

tardy hornet
#

oooooo

summer acorn
#

how would I go about fixing this again? I am trying to connect to the mongodb installed on a vps.

delicate shore
#

How can I make my bot change 32131 to 320K

tardy hornet
#

?

rustic nova
delicate shore
#

yess

rustic nova
#

rounding and something else

delicate shore
#

How '

summer torrent
#

which lang

delicate shore
#

js

summer torrent
#

Math.round()

delicate shore
#

ok

#

but

heavy yacht
#

Help me

#

Now buddy, I can't make a top. gg background while I'm doing the site, so it's kooyaed everywhere, can you assign this background code

summer torrent
#

no

#

go code yourself

#

@delicate shore Thonk

delicate shore
#

ok

wise quartz
#
Command raised an exception: TypeError: 'int' object is not iterable

what does this error mean? (py)

summer torrent
#

are you trying to make a loop (i dont know py)

wise quartz
#

yeah

opal plank
summer torrent
heavy yacht
#

I'm doing it, but it's copied, it's scattered everywhere, there are a million of them.@summer torrent

summer torrent
#

please learn basics

sick sluice
wise quartz
#

for i in len(thing):
should work right?

#

the thing is an array

sick sluice
#

it won't

#

you need to use range

heavy yacht
#

I know the basics but it's not happening, getting too big, finding a big gif, getting smaller and dying a million

#

@summer torrent

wise quartz
summer torrent
#

no you dont know

#

please stop begging for code and go learn

heavy yacht
#

Weel

delicate shore
#

what is this erorr

earnest phoenix
rustic nova
#

tbh best is to force light theme and change it to dark theme through your own css

#

better control

delicate shore
#

I figured it nvm

ionic silo
#

how to use use this in the command?

SetTimeout(() => {
    }, [10000]
earnest phoenix
#

Does anyone know how to see cluster ping on discord.js mongodb

#

@ionic silo

message.channel.send('abc').then(m => {
        setTimeout(() => {
            m.edit(`abcde`)  
          }, 1000);
        })```
#

or

#
message.channel.send(`ab`).then(async msg => {
setTimeout(() => {
          msg.delete()
             }, 10000)
         })}```
#

and so it goes on

ionic silo
#

so the top one is the message is edit to abcde and the bottom one is delete the message?

#

thank you

earnest phoenix
#

Hi

#

Can somone help me?

rustic nova
#

just ask

earnest phoenix
#

How can i host my bot 24/7?

rustic nova
#

with a vps

earnest phoenix
#

what?

#

means vps

rustic nova
#

A virtual private server (VPS) is a virtual machine sold as a service by an Internet hosting service. The virtual dedicated server (VDS) also has a similar meaning.
A VPS runs its own copy of an operating system (OS), and customers may have superuser-level access to that operating system instance, so they can install almost any software that run...

earnest phoenix
#

Ok

#

Thanks

#

How I configure?

#

would recommend researching on google for that

#

for mine i just use my own linux server

#

you can do it on any old laptop but its abit inconvenient

opal plank
delicate shore
#

Yes

opal plank
#

'188836645670223872' is a snowflake

#

'<@123478917294>' is a mention

delicate shore
#

Thanks for help tho Erwin

opal plank
#

np

earnest phoenix
#
sudo apt install nodejs

you can use that for most linux installs

#

np

#

i would recommend doing sudo apt-get update && sudo apt-get upgrade if you have installed your linux os recently

#

what is the name of it?

#

here

#

np

#

ive had no sleep and i forgot for a min that other linux os dont have the same commands

#

😂

#

ive got ubuntu server installed so its pretty easy to install stuff

#

what machine are you using to run the os?

#

hardware

#

ah ok

#

raspberry pi 3b+

#

its a tiny computer

#

XD

#

its great for bot hosting if its relatively small

rough knot
#

What is the best place to host a bot cause i need a database.txt file in, but idk how to get it in on heroku, any help to host i can use instead? That is free

#

Im working on a extention for my bot

#

Thats why i need database

earnest phoenix
#

i wouldn't recommend using a txt file as a database

rough knot
#

what then

earnest phoenix
#

sqlite

rough knot
#

I use better-sqlite3

#

how do i fix?

earnest phoenix
#

what language?

rough knot
#

Java

#

script

#

Using Node.js

earnest phoenix
#

ah sorry cant help there, i code in python

rough knot
#

OOf

#

I rlly need help by others rn

#

I only have 5m left

earnest phoenix
#

hmm

rough knot
#

Im on phone rn

#

Anyone know how to fix the db?

earnest phoenix
#

you haven't provided any info for the people who do know js

rough knot
#

Lemme send

#

Wait

steel heath
astral yoke
#

bot.on('messageReactionAdd', async function(reaction, user, guild){ how would i get the person who reacted and then be able to dm them

#

because reaction.message.author.send dont work

vocal sluice
# slender thistle ??

like so i have a role called Game 1 how do i make it so each time it is created it goes up in number

slender thistle
#

number = 1
for role in someIterable
create role
number = number + 1

earnest phoenix
#

why don't just enumerate it

carmine summit
#
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .title {
        text-align: center;
        padding-top: 50px;
        font-family: "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS",
          sans-serif;
        font-size: 50px;
      }
      .titleBackground {
        width: 100%;
        height: 200px;
        background-color: lightblue;
      }
      .titleBackground :hover {
        background-color: yellow;
      }
    </style>
  </head>
  <body>
    <div class="titleBackground"><div class="title">Test</div></div>
  </body>
</html>

``` Why is it not all yellow ? I want all the blue to be yellow
steel heath
#

set its (min) height to 100vh

carmine summit
#

huh?

#

I want all the blue to be yellow

#

for some reason only the half until the bottom of the text is being yellow

cinder patio
#

You set it so it's yellow when you hover over it

carmine summit
#

yes i know but why is the blue left over

cinder patio
#

Because in the .titleBackground rule you set the background color to light blue?

#

It will be yellow only when you hover over it

#

otherwise it will be blue

earnest phoenix
#

you can add padding-bottom on title class, but pretty sure there's better way to do it

pale vessel
carmine summit
#

hmm

#

yes it is expected that if i hover over it, it will be yellow

#

but it is not expected that there will be some leftovers on the bottom

cinder patio
#

Try adding display: inline on the title class

drifting shell
#

need a bit of lavaplayer help

#

im trying to figure out how to do equalizer shit, but ive genuinely no clue what im doing

zealous helm
#

Excuse me

earnest phoenix
#

my bot wont do commands since ive added my ban command could u help

#

could we call and u help?

zealous helm
#

I need help

slender wagon
#
const lb = leaderboard.map(e => `${e.position}. ${e.username}#${e.discriminator}\nLevel: ${e.level}\nXP: ${e.xp.toLocaleString()}`);

it throws leaderboard.map is not a function

zealous helm
#

I need to delete a Command for deleting the post my bot makes, please help. Javascript will work

whole knot
#

@earnest phoenix I do not get the question, what is the problem right here?

umbral zealot
umbral zealot
zealous helm
#

I need to delete a Command for deleting the post my bot makes, please help. Javascript will work

umbral zealot
#

But what does that mean?

whole knot
#

I guess he wants to delete messages with his bot

zealous helm
#

And I need an opinion to delete it

umbral zealot
#

Well, message.delete() usually does it, assuming discord.js

zealous helm
umbral zealot
#

It's a method of the discord.js Message class.

#

"javascript" is a language, but that doesn't tell us what library you're using, and every library does this differently.

zealous helm
#

Does discord.js us javascript

umbral zealot
#

yes.

gritty sinew
#

Yes

umbral zealot
#

But... like... you're probably already using a library, so you need to use that library to do this, not another one.

zealous helm
#

I got it

gritty sinew
#

You need to download mode.js first

#

Node

zealous helm
#

I don't

gritty sinew
#

Then use powershell to add discord js

umbral zealot
#

yo they already have a bot man, they don't need a step by step beginners guide 😛

zealous helm
#

How do I make it select the last message sent by you

umbral zealot
#

It depends. Do you want to delete that embed on a reaction? Or how?

zealous helm
#

What 😂

umbral zealot
#

I'm confused here. You should know what you want to do - this is your bot, you made it, we can't tell you what you want to do.

#

I've been helping people code bot for 4 years, if you want help, you have to ask the right things and answer the right questions.

#

The question was: what is the trigger for you deleting the message? How do you want to tell the bot to delete it?

#

You're not going to get anywhere starting from scratch.

#

Are you not able to answer the question I asked? I can help you if you do.

#

No one can help you if you can't answer that question.

#

Deleting your message pretending our conversation didn't happen isn't helpful either

#

you're removing very important context for people to understand what's going on.

zealous helm
#

OMG LEAVE ME ALONE

#

Someone will read it and help me

old latch
zealous helm
#

Leave me tf alone

umbral zealot
#

Interacting with humans is hard, on this planet. I don't know how y'all do it >.<

old latch
#

me neither

zealous helm
#

I need to delete a Command for deleting the post my bot makes, please help. Javascript will work

old latch
#

hello

#

wait you need something that deletes your bot's message?

zealous helm
#

Yes

old latch
#

discord.js?

zealous helm
#

Javascript will work

old latch
#

<message>.delete() is the easiest way

#

well there are different libraries which one do you use?

zealous helm
#

Idk what that means

old latch
#

oh gosh

#

what are you using to code your bot?

zealous helm
old latch
#

wait you are coding on your phone?

#

dang then I dont think I can help you

quartz kindle
#

is that bot designer? lol

umbral zealot
#

If that BDFD? They're a special little snowflake, you'll need to ask on their server for help on how to use it.

zealous helm
#

I can't

old latch
#

are you banned?

zealous helm
#

I am

quartz kindle
#

why lol

old latch
#

yo

sudden geyser
#

how did you pull that off

earnest phoenix
#

eh

umbral zealot
#

I'm guessing behavioural issues and getting angry that people ask questions when they want to help? ayy

earnest phoenix
#

LOL

old latch
quartz kindle
#

or complaining when not receiving help?

earnest phoenix
#

imagine helping unknown people in coding

#

EWWW

old latch
#

well anyways we can't help you then

earnest phoenix
#

LOL

zealous helm
#

Thank you

quartz kindle
#

ye, nobody here uses BDFD sorry

earnest phoenix
#

i didnt say i want help togira KEKW

old latch
#

not you

earnest phoenix
quartz kindle
#

i mean, i've seen some people use it, but the vast majority here doesnt use it

earnest phoenix
#

bye

old latch
#

I've never seen it

zealous helm
#

I need to delete a Command for deleting the post my bot makes, please help. Javascript will work

umbral zealot
#

Yo, we can't help you, stop.

old latch
#

bro

#

we told you we can't help, yes

zealous helm
#

YOU'RE NOT THE ONLY PEOPLE HERE TF

#

Leave me alone

umbral zealot
#

Nobody here can help you with BDFD, because we're programmers not button mashers.

quartz kindle
#

i can see why he was banned

zealous helm
#

So you're telling me

#

Out of the 5000 developers here

old latch
#

yeah right there aren't much people here using what you use

zealous helm
#

You know for facts

#

No one can help

quartz kindle
#

out of 5000 maybe 10 use BDFD, and 99% chance none of them are online

zealous helm
#

That's what you're trying to say rn

umbral zealot
#

We're telling you, if you keep saying "javascript will work" without telling people you're actually using BDFD and how/why/when you want the message to be deleted, you're not helping yourself

zealous helm
#

So regardless

#

I'm waiting

old latch
#

we are just being realistic

zealous helm
#

No you're not

umbral zealot
#

You need to actually know how to describe problems in the first place. Your context is very important.

old latch
#

we are

zealous helm
#

Ok byeeee

quartz kindle
#

if they were online they would have replied. your best bet is to ask again every 30 minutes or so, and ask if anyone uses BDFD

old latch
#

bye

lime spade
#

How do i get members array now in discord.js v12?

umbral zealot
#

guild.members.cache

random pagoda
#

How can I add commands to my bot

quartz kindle
#

you code them

quick ginkgo
quartz kindle
#

bot designer for discord, at least i think thats the full name lol

umbral zealot
#

Yep, that's it.

quartz kindle
#

its an app on google play

safe creek
#

yes

quick ginkgo
#

ahhh

#

an app

#

??????

quartz kindle
#

yes

quick ginkgo
#

lmao

safe creek
#

and ew bdfd xd

quartz kindle
#

exactly

pale vessel
#

can I draw a discord bot and generate a code from it

quartz kindle
#

wat

lime spade
quick ginkgo
#

with an advanced library that converts images to stuff

umbral zealot
#

There's no "new discord API"

safe creek
#

i used it to make my friend an bot so it wouldnt take months and ew its trash

quick ginkgo
umbral zealot
#

If you mean intents, then, in order to get the full member list, you do have to fetch all the members, and that means, you would need the GUILD_MEMBERS intents.

#

You probably don't need it, so it really depends what you're looking for in the members cache.

quick ginkgo
#

but discord.js is deprecated and no longer updated, never updated to work with the new intents and stuff

old latch
#

ohh once I'm being here, if I want a listener on "guildMemberRemove" I need that presence intent or however it's called right?

umbral zealot
#

what? no?

umbral zealot
#

discord.js is absolutely not deprecated, what are you talking about

quick ginkgo
#

wait huh???

quartz kindle
#

LOL

#

where did you get that info from?

old latch
#

I'm using d.js works super find

umbral zealot
#

Discord.js V11* is deprecated. The one from, like, a year ago. V12 is fine.

old latch
#

fine*

quick ginkgo
#

hmm ignore everything i said then

#

i thought it was

quartz kindle
#

and v13 will be released soon

earnest phoenix
#

are you guys still talking here KEKW

old latch
#

ohh once I'm being here, if I want a listener on "guildMemberRemove" I need that presence intent or however it's called right?

umbral zealot
#

I mean you shouldn't do that, add the same role to all members, to be honest.

#

There's already a role that affects all your members. It's the @everyone role.

earnest phoenix
#

hi

old latch
#

evie

quartz kindle
old latch
#

ah

#

thx

#

is this one of those you have to request separately?

quartz kindle
#

you have to enable it in the dev portal yes

old latch
#

ah dang

#

I wasnt being sure thx

earnest phoenix
#

what's the difference between Fetch API and XMLHttpRequest

umbral zealot
#

And when verifying you have to request it to Discord, and... well... they probably wouldn't give that for someone that just wants to give colors to their users wiht a role. 😄

quartz kindle
#

xD

earnest phoenix
#

lol

umbral zealot
earnest phoenix
quartz kindle
#

the second one is a class

#

the first one is a function

earnest phoenix
#

class?

quartz kindle
#

yes

umbral zealot
#

Then again new is actually not mandatory when you create a new class with no constructor options

earnest phoenix
#

but you can execute new keyword on any function

quartz kindle
#

because js is wonky

earnest phoenix
umbral zealot
#

And w3schools sucks hairy monkey balls, don't trust it or use it.

quartz kindle
#

also, classes were created with objects before ES6

earnest phoenix
#

new keyword just inherits the prototypes from the class/function and nothing else amirite?

quartz kindle
#

and a lot of other hacky ways

umbral zealot
#

yeah the whole prototype thing from the 1990's is a bit awkward and imprecise.

old latch
umbral zealot
#

yeh

old latch
#

woow

#

pro

#

javascript help?

random pagoda
#

how do i get code to add command

umbral zealot
#

I'm... good at explaining things very simply, I guess.

old latch
#

I will use that as future reference if I need help with js :)

umbral zealot
quartz kindle
#

or use bdfd

#

jk im trolling

old latch
#

lmao

quartz kindle
#

watch him ask the exact same question 15 min later

safe creek
quartz kindle
#

that looks like you're swearing

umbral zealot
old latch
#

"facts" would be enough but yes I agree

safe creek
#

lol

earnest phoenix
#

I'm bored

umbral zealot
old latch
#

yeah star it why not

#

lmao

#

omg

#

haha

earnest phoenix
#

I was the first one to star that

old latch
umbral zealot
#

Alright so anyway, does anyone have #development -related questions? 😛

#

Don't be shy, speak up!

quartz kindle
#

my code no work pls halp

#

well i have a serious question about js that i've never seen answered anywhere

#

why are arrays in js so damn slow

#

compared to string operations

#

for example

pure lion
#

Because we said so
~ V8

hollow sedge
quartz kindle
#

if you have 100k items in an array, and you want to find 1 item, it takes 10 times more time than if you have 100k items in a string, delimited by whatever, and find the item in the string

pure lion
#

@hollow sedge what the fuck

pale vessel
#

Exactly

hollow sedge
pale vessel
#

That actually could be a thing

hollow sedge
#

but why

pale vessel
#

Like you know, yahoo pipes

#

but discord bots

pure lion
#

I don't wanna be here any more byebye

hollow sedge
umbral zealot
# quartz kindle why are arrays in js so damn slow

Because they're less real arrays than they are... "dictionaries". real arrays have a fixed length and usually a fixed type so the array can be seeked by start memory position + (index * array item size) , but you can't do that in JS. So JS arrays suck .

earnest phoenix
#

FREE CODE FOR BOTUMS! (WORKING 2020!)

console.log("figure it out yourself");
process.exit();
old latch
umbral zealot
#

This is why in, say, Java, you need to actually define an array of fixed length and type.

hollow sedge
quartz kindle
#

im working on a project that will require caching of about 15mb of string data, compromising of 500k items

umbral zealot
#

Or, really, any strongly-typed language, and especially closer to the hardware you get.

earnest phoenix
#

Because they're less real arrays than they are... "dictionaries"
map has left the chat

quartz kindle
#

and to find 1 item in those 500k takes 100ms via arrays, an 2ms via string.indexOf()

hollow sedge
#

wait what? FIXED length?

umbral zealot
#

"find" how though

quartz kindle
#

not to mention that converting the string to array makes it waste 3 times more memory

wintry cipher
#

what makes a discord bot good???

umbral zealot
#

optimisation cannot be linked to generalisation. They're mostly contrary terms. (mutually exclusive)

earnest phoenix
old latch
quartz kindle
umbral zealot
quartz kindle
#

grep is faster for everything else

umbral zealot
earnest phoenix
umbral zealot
#

JS's idea of performance is "scale more"

quartz kindle
#

i know but if performing an in-memory operation is significantly slower than performing a disk operation, something is seriously wrong

#

thats here im butting my head

sudden geyser
quartz kindle
#

regardless of how slow js is, in-memory operations should not be slower than disk I/O

umbral zealot
#

Well... again it depends how you do your find/search

quartz kindle
#

i tested everything

umbral zealot
#

no no I mean, what specifically and exactly are you looking for?

earnest phoenix
#

have you tried maps

quartz kindle
#

for loop, while loop, indexOf, includes, .find

#

basically the same as grep "abc"

umbral zealot
#

yeah but each tool has different uses and optimisations

#

looking for "abc" in a string, of course it's gonna be faster to do a full string search - hell, regex can do it

#

If you're looking for a string in an array containing something, find() would be good enough

#

if you're looking for something at a specific key, then an Object is faster

quartz kindle
#

i tested objects, and its still slower than grep

#

even if you know the key

earnest phoenix
#

umm i can't enable spotify secure web playback in brave

umbral zealot
#

you can't compare JS with grep, it's just not even the same ballpark

quartz kindle
#

not to mention converting 500k strings into an object makes it use 200mb of ram instead of 15mb for some reason

umbral zealot
#

grep is, what, assembly? fucking binary? it's code that's compiled down to the barebone

#

versus an interpreted language

quartz kindle
#

im not comparing the languages, im comparing disk vs in-memory

umbral zealot
#

the comparison is wholly inadequate, and absolutely unfair.

old latch
#

lol evie thx so much for the link to your website I understood everything about classes now

quartz kindle
#

grep performs a disk operation, it reads the file from disk. while performing an in-memory operation, even if less efficient, should be faster

old latch
umbral zealot
#

Yeah but the reading of the data, compared to the actual looping through it, are two different things

#

maybe grep loads single files real fast because, again, it's a super barebone compiled tool that's been optimized for decades even before JS existed

earnest phoenix
umbral zealot
#

enable what

#

What does this have to do with programming? lol

earnest phoenix
#

um idk

quartz kindle
#

its still a disk operation, thats why i was scratching my head, like i wanted to cache the data in memory to have faster lookup and access times, only to be crushed by grep lol

pale vessel
#

windows caveman edition
~cry 2020

earnest phoenix
#

if you come with a problem running windows ooga booga edition people will tell you to just update

#

yes

#

<3

pale vessel
#

ly cry

umbral zealot
#

I'll repeat: the comparison between a tool that's been optimised for the last 35 years versus an in-memory interpreted process is absolutely unfair

#

this isn't apples and oranges, this is bike versus maglev train

old latch
#

is coding part of your job?

earnest phoenix
umbral zealot
#

I'm a web developer yeah

old latch
#

okay makes sense you know so much haha

sudden geyser
#

is windows 7 still popular in usage today

pale vessel
#

yeah

quartz kindle
#

no matter how many years of optimizations you have, you are limited by I/O performance

#

so i was surprised

#

thats all

umbral zealot
#

I've also been working with JavaScript for almost 25 years so... yeah there's that.

old latch
#

uh wow

#

so can I ask you if I have any questions about js?

umbral zealot
#

you can certainly ask here and I can answer if I'm available 😉

old latch
#

noted

slender thistle
#

boomer

dapper ocean
#

Guys, I created a command. Is it that flashy to make epilepsy go BRR?

slender thistle
#

How...

dapper ocean
#

Bruh

pale vessel
#

Same here

slender thistle
#

Discord you living clusterfuck of all broken things

dapper ocean
#

Wrong format

pale vessel
#

.mov 😩

#

what's next, mkv

earnest phoenix
#

raw

pale vessel
#

just send an octet stream

slender thistle
old latch
earnest phoenix
#

my school recently updates all pcs to win10

sudden geyser
#

didn't microsoft drop windows 7 support though

slender thistle
#

But in my school we had Win10, so they're probably moving away more and more from it slowly

#

Yeah

earnest phoenix
#

yeah

pale vessel
#

They did

#

But you can pay for updates

#

but it's goddamn expensive

sudden geyser
#

yikes

pale vessel
#

just fucking upgrade ffs

#

i hate my school

#

The computers keep showing that activation popup

earnest phoenix
#

big companies don't want to because they have prehistoric code

#

i.e. banks

pale vessel
#

or code913 apparently

earnest phoenix
#

or because you will execute rocket science and blow up your already terrible computer trying to install windows 10

#

when banks are supposed to be one of the most securely made places in the world but you find out they run trashy written BASIC 😩

#

i mean it can't run windows 7 properly

hollow sedge
#

makes sense that they wouldnt want to break that though

sudden geyser
#

written in matlab™️

earnest phoenix
#

im scared to go anywhere near matlab

#

wait we have rules channels in discord now?

#

we had it since the community servers update

#

they just have a different icon now

#

k

hollow sedge
#

i mean is there really a point for a rules channel if not for the icon?

earnest phoenix
#

nobody: reads rules channel

#

things are looking like discord is going to implement the option to enforce reading the rules channel

earnest phoenix
hollow sedge
#

how would they enforce that though

earnest phoenix
#

gtg bye guys

#

h

hollow sedge
#

the only thing they can do is make you wait for some time or have you scroll to the end

earnest phoenix
#

JS is awesome

#

python bad

#

bye

hollow sedge
#

😮

#

yeah leave

sudden geyser
#

language war 6218

safe creek
#

how tf

#

does that not work

earnest phoenix
#

your function is empty

safe creek
#

im doing something

hollow sedge
#

@safe creek if you want to have an empty function

#

write pass

earnest phoenix
#

^

safe creek
#

so that may be why

#

im doing somthing so that may be why

hollow sedge
#

that doesn't mean anything

#

"im doing something"

earnest phoenix
#

not may be, that is why mmLol

safe creek
#

mmmh

#

welp

sour oxide
#

hi

safe creek
#

off i go

safe creek
hollow sedge
#

the error is 100% because you didnt put anything inside the function

safe creek
#

yes well im doing somthing like i said the last 2-3 times

earnest phoenix
#

then finish it before running, otherwise put pass

safe creek
#

and already know now

#

wi;;

#

will

zealous helm
pale vessel
#

what is this again

#

bfd or something

zealous helm
#

Yes

pale vessel
#

bdscript?

zealous helm
safe creek
#

@zealous helm join the bdfd support server lmao

zealous helm
#

The variable should set to the last message ID you sent

#

Oh waittt

safe creek
#

and you used a var?

zealous helm
safe creek
#

vars are only used for commans to set a value like numbers or true/false

#

so unless you have an var named what var you put inside there it wont work lol

zealous helm
#

WHAT

safe creek
#

you used an var not confusing to understand lol

#

nor hard

zealous helm
#

That's subjective

safe creek
#

i guess

zealous helm
#

And it's setup properly

cinder patio
#

Can't you also use javascript?

zealous helm
#

Yes

safe creek
#

its very limited

cinder patio
#

instead of that shitty language

safe creek
#

yeah

#

its really shitty lol

zealous helm
#

Not hating on a bot

safe creek
#

i used it for about an month and said fuck this

old latch
safe creek
#

lmfao

old latch
safe creek
#

i wonder why thonkdontfeelsogood

old latch
#

look up their message history in this channel and you will get an answerPaul

safe creek
#

wow this kid is stupid, annoying, ignorant and also likes to be an asshole too eh

old latch
#

well I wouldn't say it like that but okay

safe creek
#

well

zealous helm
#

Not talking shit 😂

old latch
safe creek
#

are you sure

earnest phoenix
#

bruh

zealous helm
#

Not missing the context

safe creek
#

ypu like to be an asshole so idk man FeelsSpecialMan

zealous helm
#

Did you even read what was happening

#

Or do you just form opinions like that 😂

old latch
#

it was ridiculous what happened

safe creek
old latch
#

yeah

zealous helm
#

Be like what

earnest phoenix
safe creek
#

an as hole, telling people to stfu etf

old latch
#

being rude to anyone and any staff member in general is a bad idea

zealous helm
#

Bruh

safe creek
#

^^

zealous helm
#

What was happening

old latch
earnest phoenix
zealous helm
#

You dek

old latch
#

dek?

earnest phoenix
#

dek

old latch
#

ic

earnest phoenix
#

textbook definition of scripting kid

#

lol

safe creek
#

dek lolol

earnest phoenix
#

I have a strong feeling this guy is under 13

zealous helm
#

It's all good

old latch
#

lets ask them

zealous helm
#

I love you all

old latch
#

how old are you?

safe creek
#

with a temper and pfp like that it is sus

earnest phoenix
safe creek
old latch
safe creek
#

lol

earnest phoenix
#

xdddddd

zealous helm
#

Looking for help with my bot

safe creek
#

ignorant

#

it seems

#

theyre under age

earnest phoenix
#

I agree

zealous helm
#

This is harassment

#

I'm reporting

safe creek
earnest phoenix
#

idk if hes joking or not

zealous helm
#

Dead ass

old latch
#

hmm I wouldn't report if I were you, just my personal advice

safe creek
#

probably not with how hes been

#

hes been quite rude so

old latch
#

that's why

earnest phoenix
#

if anyone's harassing its you

safe creek
#

loollllllllllooo

earnest phoenix
#

I'm reporting
if this was reportable and/or punishable 99% of the internet would be snapped out of existence

safe creek
#

brb reporting my self for harringsing my self lolol

zealous helm
#

I'm looking for help with my bot

safe creek
#

how old are u bud?

earnest phoenix
#

nobody here supports shitty third party scripting languages

old latch
#

we told you earlier that best for you is to join that bot maker thingy's support server

earnest phoenix
#

go complain to their support server

#

^^^^