#development

1 messages ยท Page 1037 of 1

autumn aspen
#

@autumn aspen You need to put that in a function, or in the case of discord.js in a client.on() method. Otherwise it will not fire.
@steep cedar thx

steep cedar
#

You should know the basics of JS before starting out with a library as complex as discord.js

autumn aspen
#

I get it

cinder patio
#

Inside the guildMemberAdd..

autumn aspen
#

You should know the basics of JS before starting out with a library as complex as discord.js
@steep cedar

const PREFIX = "!";```
cinder patio
#

or whatever the event's name is

solemn latch
#

Prefixes can be your cache, you can make it anyway you want.

For example
.get can get what you want, if it doesn't exist returns the default.

.set can set your cache and update it in the db.
Or it can be your db directly and you can cache another way.

steep cedar
#

@steep cedar

const PREFIX = "!";```

@autumn aspen Write variables either in camelCase or snake_case. That is just ugly. And yes, I know that. I want to allow every server to store their own prefix in a database so one server can have prefix "!" while another uses the prefix "?"

solemn latch
#

The structure can be what you want

earnest phoenix
#

so will bot.user.setPresence({activity:{name:"yeet"},status:"dnd"}) work?

steep cedar
#

Prefixes can be your cache, you can make it anyway you want.

For example
.get can get what you want, if it doesn't exist returns the default.

.set can set your cache and update it in the db.
Or it can be your db directly and you can cache another way.
@solemn latch What kind of DB is that for?

autumn aspen
#

yes

slender thistle
#

I get it
Yet you still ignore any advices to learn JS itself

autumn aspen
#

No

#

Im reading now

steep cedar
#

Yet you still ignore any advices to learn JS itself
@slender thistle That's what I'm talking about.

earnest phoenix
#

@solemn latch What kind of DB is that for?
@steep cedar quick.db

#

that's what i use

#

for my bot's terrible economy system

slender thistle
#

I've been reading this channel for the past few days and I'm not taking that opinion out of the blue

steep cedar
#

that's what i use
@earnest phoenix Okay thank you.

strange trout
#

You could store prefixes in a collection or map

client.prefixes = new Collection 

client.on('message' () => {
  const prefix = client.prefixes.get(message.guild.id);

  // rest of logic here
});
steep cedar
#

Is quick.db good for scaling?

#

Or rather a "small" solution

earnest phoenix
#

small

steep cedar
#

You could store prefixes in a collection or map

client.prefixes = new Collection 

client.on('message' () => {
  const prefix = client.prefixes.get(message.guild.id);

  // rest of logic here
});

@strange trout That I then need to store and fetch once the bot restarts

solemn latch
#

I've never used quick.db
I use mysql and a few tsdb's

strange trout
#

When a guild changes the prefix simply update it in the collection as well

steep cedar
#

Yes, I can do that with Maps thats no problem. I just need it to stay available after restarting the bot.

earnest phoenix
#

i use uncomplicatedenoughtobeunderstandablebya1yearold solutions

steep cedar
#

That's is possible but maybe not the best way to approach a scenario.

cinder patio
#

The cache resetting after a restart shouldn't be a problem

#

That's the point of a cache

earnest phoenix
#

imma go run EVERYSINGLECOMMAND my bot has in order to check if i broke smth

cinder patio
#

To store things in memory so you get them faster

earnest phoenix
#

why do all tutorials on yt show discord.js v11

autumn aspen
solemn latch
#

In my case, get gets from the cache, if its not in the cache check the db.
If the db doesn't have that row, get the default one and add the default to the cache for that guild

earnest phoenix
#

KOMMUNIST

#

Welp why error?
@autumn aspen it is literally defined as an event

#

do you want that or smth else

#

and you sure the role works?

steep cedar
#
1) Fetch Collection from DB server
2) Check if message from specific guild starts with set prefix in Collection
3) If, run command
4) After somebody changes command, change the Collection and update the db with the updated Collection

Correct?

digital ibex
#

bot.on is a callback function

earnest phoenix
#

and can you show your errors

steep cedar
#

imma go run EVERYSINGLECOMMAND my bot has in order to check if i broke smth
@earnest phoenix If you knew what exactly you were doing there wouldn't be a need for that.

strange trout
#

Learn JavaScript like you've been told. You don't have any idea what you're doing even after getting help from multiple people@autumn aspen

cinder patio
#

I think it would be faster to cache prefixes as they come and not cache all of them at the start

solemn latch
#

^

earnest phoenix
#

i use v11 for months and i updated 5 minutes ago @steep cedar

steep cedar
#

Welp why error?
@autumn aspen what the fuck is this

#

i use v11 for months and i updated 5 minutes ago @steep cedar
@earnest phoenix Oh okay, sorry then

earnest phoenix
#

np

#

nope

cinder patio
#

That's actually valid syntax, but the usage is not correct lol

earnest phoenix
#

???

autumn aspen
#

@autumn aspen what the fuck is this
@steep cedar LMAFO

earnest phoenix
#

what are you trying to say lmao

autumn aspen
#

w8

#

brb

earnest phoenix
#

LMAFO you spelled LMAFO

#

i did too smh...

strange trout
#

I should cache my prefix

steep cedar
#

@autumn aspen client.on() is a method only used for events. What you set as an event above is a statement, so something that is "executable".

digital ibex
#

holddizzt, you've literally been here for days after like 5 different people have told u to learn js catshrug

steep cedar
#

That doesn't belong there where you put it.

solemn latch
#

Yikes hes having that issue again?

#

It took 5 of us to get him to put an if statement in an event

strange trout
#

We need an army

pure lion
#

What happened

#

Oh god

steep cedar
#

Look, it is a lot more fun to write proper JS and know why stuff works. Read normal JS docs, then you will have way way less problems with discordjs but 99% of problems you have here are because of incorrect use of JavaScript, not the library discordjs.org

earnest phoenix
#

how to create channels with specific perms for @.everyone and save the ID?
(no begging for spoonfeed but please don't take me to the docs i don't get anything)

pure lion
#

I'm joining the army

steep cedar
#

@pure lion Your username is epic and I feel it

earnest phoenix
#

lol

strange trout
#

@earnest phoenix check out the docs

earnest phoenix
#

join da army

steep cedar
#

I don't like the docs either i must admit

autumn aspen
#

@autumn aspen client.on() is a method only used for events. What you set as an event above is a statement, so something that is "executable".
@steep cedar w8 pls

steep cedar
#

@steep cedar w8 pls
@autumn aspen Sure

earnest phoenix
#

waits 5 seconds

#

and forgets to emphasize text like dis

digital ibex
#

some people should have a "no development" role so they can't talk here

earnest phoenix
#
  • this is what i was trying to do *
#

some people should have a "no development" role
@digital ibex or a goldfish brain role for peeeps like meeeeeeeeee

#

meee6 suxxxx

autumn aspen
#

@steep cedar need help I dont know about this command, all I know is I need to have this bc I ned my bot to give a role when someone join.

#

someone help me

cinder patio
#

We can't help you because you are refusing to listen

earnest phoenix
#

IT LITERALLY GIVES A ROLE WHEN SOMEONE GIVES A ROLE ๐Ÿคฃ

slender thistle
#

idk anymore

autumn aspen
#

LOl

earnest phoenix
#

not when someone joins

tulip ledge
#

I'm wondering how much ram a bot will use when it has like 1000 guilds

autumn aspen
#

not when someone joins
@earnest phoenix oh

#

Lmao

cinder patio
#

depends

tulip ledge
#

Mine is in 130 and it already used 77 MB on avarage

earnest phoenix
#

my bot will use zero ram it's supposed to be my brain

cinder patio
#

It depends on what the bot does, which library it uses, what gets cached and what not

strange trout
tulip ledge
#

And the one I'm working on rn is only in 4 and it used 64 MB average

earnest phoenix
autumn aspen
#

Bruh lemme see the docs but witch category should I be on if I wanna perms and give a role when someone joins?

digital ibex
#

64mb??

earnest phoenix
#

witch

digital ibex
#

what are you doing with it?

earnest phoenix
#

wdym witch

tulip ledge
#

Alot of calculations

earnest phoenix
#

death probably

#

killing ram

autumn aspen
#

wich

digital ibex
#

u shouldn't be dong that with nodejs then

steep cedar
#

Hold up your bot has 64MB?!

earnest phoenix
#

(i use glitch for mining bitcoin HEHHE but my projects got deleted ๐Ÿ˜ญ)

steep cedar
#

Or what has 64MB

autumn aspen
#

Hold up your bot has 64MB?!
@steep cedar Kill me

earnest phoenix
#

his bot uses on average

tulip ledge
#

My bot uses 64MB ram

steep cedar
#

(i use glitch for mining bitcoin HEHHE but my projects got deleted ๐Ÿ˜ญ)
@earnest phoenix Its probably against Tos

strange trout
#

64mg is fine

tulip ledge
#

When its being used

strange trout
#

mb

tulip ledge
#

On idle it's like 20 MB

steep cedar
#

Sound okay

digital ibex
#

for 4 servers tho?

earnest phoenix
#

should i put the code of a random game here?
react with ๐ŸŽ‰ atleast 5 reacts

steep cedar
#

Didn't look on mine though

slender thistle
#

no

digital ibex
#

im pretty sure thats kinda a bit more than it should be

slender thistle
#

I hope you do realize that this is a development channel and there's a fuckton of selfbots for 100k members

autumn aspen
#

yes

tulip ledge
#

?

#

Wait what

autumn aspen
#

sooo

steep cedar
#

Sorry I missed anything, but what are selfbots?

autumn aspen
#

bruh

slender thistle
#

userbots, actually

digital ibex
#

user account bots

slender thistle
#

Automated user accounts

steep cedar
#

Oh okay, then I thought correctly.

slender thistle
#

in this case they claim gifts instantly

earnest phoenix
#

wait what people don't want me to put the code of a game here

autumn aspen
#

Yeah

earnest phoenix
#

by code i mean gift code

#

not the leaked source

steep cedar
#

bruh
@autumn aspen You my buddy cant say bruh in this channel

slender thistle
#

Yes because it'll be gone anyway

steep cedar
#

by code i mean gift code
@earnest phoenix Steam or what?

slender thistle
#

Also, keep this channel on topic

autumn aspen
#

@autumn aspen You my buddy cant say bruh in this channel
@steep cedar yup

earnest phoenix
#

discord.gift/Hmh46nKhazcEgDAzhcmYHGTX

#

Bruh

#

GG

#

No

slender thistle
#

Completely ignored my words

autumn aspen
#

YEAH!!!

slender thistle
#

also

Also, keep this channel on topic

tulip ledge
#

Bots use it

steep cedar
#

Already calimed

#

claimed

#

And game looks weird whatsoever

digital ibex
#

rip this channel

earnest phoenix
#

wait what its claimed

slender thistle
#

HELLO THIS IS #development CHANNEL, PLEASE READ THE CHANNEL TOPIC

#

LAST WARNING

earnest phoenix
#

OK

slender thistle
#

thank you

earnest phoenix
#

welcome

steep cedar
#

Okay guys

#

Lets return to topic

autumn aspen
#

Wait what gift was it?

steep cedar
#

Stfu

#

Returning to topic

earnest phoenix
#

what does bot.on("guildCreate") do

autumn aspen
#

WHat gift was it?

tulip ledge
#

When the bot joins a guild that gets fired

steep cedar
#

Exactly

slender thistle
#

WHat gift was it?
@autumn aspen did you not read my messages

earnest phoenix
#

shivaco warn him

autumn aspen
#

Oh yeah

steep cedar
#

Should be called guildOnJoin much rather, create is a bit misleading

earnest phoenix
#

(why telling a mod to do stuff)

autumn aspen
#

CHill I just wondered

raw ravine
#

If i wanna host my JDA music bot on heroku, what should be the content of the Procfile

tulip ledge
#

Well no a new guild object is created

slender thistle
#

The event guildCreate is fired whenever your bot joins a guild or a guild becomes available

steep cedar
#

Well no a new guild object is created
@tulip ledge oh yeah

tulip ledge
#

So it's not middleading

earnest phoenix
#

Should be called guildOnJoin much rather, create is a bit misleading
@steep cedar by should you mean it is an alternative?

autumn aspen
#

@slender thistle why can I ping all moderators and admins?

steep cedar
#

So it's not middleading
@tulip ledge ur right

slender thistle
#

Will you please

steep cedar
#

does it give you the new guild as argument?

slender thistle
#

keep this channel on topic

tulip ledge
#

???

autumn aspen
#

Ok

tulip ledge
#

Wut

slender thistle
steep cedar
#

alright

#

ima shut up

slender thistle
#

not you

steep cedar
#

oh ok

tulip ledge
#
  1. I just said guilds are objects
  2. It returns the object when called
#

Arguments are things you pass

#

So code can never give you arguments

earnest phoenix
#

guilds are objects where we peeps try to fit inside

slender thistle
#

The library only gives you an object

#

the object is saved in a variable

earnest phoenix
#

upto 200k in a normal server and 450k for verified servers

slender thistle
#

the name of the variable depends on you

steep cedar
#

the object is saved in a variable
@slender thistle That's what I mean

earnest phoenix
#

can someone link me the text channel create discordjs link again?

#

So could the guildCreate event be used to send a message when the bot joins a server?

tulip ledge
#

Yes

earnest phoenix
#

Ok nice

slender thistle
#

So could the guildCreate event be used to send a message when the bot joins a server?
@earnest phoenix Yes but you would have to guess where to send the message

steep cedar
#

client.on('guildCreate', createdGuild => {...})
What is createdGuild called here? I'm mixing up syntax right now. I thought it would be an argument. Or is that a property?

#

Confused

slender thistle
#

createdGuild is an argument passed to the "arrow function"

tulip ledge
#

When it fires you can loop through the channels and check if you have perms to send messages then send a message in there

slender thistle
#

imagine it like this

steep cedar
#

Yes exactly, then I was right.

#

Nah it's alright, then I mixed stuff up in my head

autumn aspen
#

Can someone send me the docs of where u do so ur bot gives a role when someone joins?

tulip ledge
#

createdGuild is not an argument tho

#

As arguments are things you pass to a function

earnest phoenix
#

Can someone send me the docs of where u do so ur bot gives a role when someone joins?
@autumn aspen
goto discordjs.org and search and STAHP BEGGING HERE

steep cedar
#

Can someone send me the docs of where u do so ur bot gives a role when someone joins?
@autumn aspen You need a event that fires when somebody joins and then use the argument this event will most probably give you and add a role. That's two different actions.

#

please learn proper js first

earnest phoenix
#

yeah

#

use grasshopper by google

#

no ads and free

#

i have certificates on there

autumn aspen
#

code chill dude

earnest phoenix
#

and why is @pliant gorge in 100+ servers and isn't verified but still works fine

spare mirage
#

?

steep cedar
#

i have certificates on there
@earnest phoenix You get certs? Epic

tulip ledge
#

Since it only applies after the 7th of october

earnest phoenix
#

yeah

steep cedar
#

and why is @pliant gorge in 100+ servers and isn't verified but still works fine
@earnest phoenix You tagging a bot and talking about the server.

distant jewel
#

@slender thistle i still cant get it working :/

slender thistle
#

and why is @pliant gorge in 100+ servers and isn't verified but still works fine
@earnest phoenix Because restrictions don't take place just yet

#

@distant jewel Code in DMs please

tulip ledge
#

What are u talking about @steep cedar

distant jewel
#

alright

earnest phoenix
#
bot.on("someEvent", eventName => {});
//is this the correct syntax for events?
tulip ledge
#

Should be

cinder patio
#

well not really

earnest phoenix
#

w8 what

slender thistle
#

as a template for events it's fine

earnest phoenix
#

???

steep cedar
#
bot.on("someEvent", eventName => {});
//is this the correct syntax for events?

@earnest phoenix Not quite

cinder patio
#

It's correct, but also, you could have multiple parameters passed by the event

autumn aspen
#
  .then(console.log)
  .catch(console.error);```
Guys is this the command u type when someones join?
steep cedar
#

eventName should rather be the object you are passed with the event. That is different from event to event.

tulip ledge
#

bot.on("someEvent", (eventName, otherParameter) => {});

upper thistle
#

what is the best way to have your bot DM you, when you dont specifically summon it, IE on it joining a server or something

steep cedar
#
  .then(console.log)
  .catch(console.error);```
Guys is this the command u type when someones join?

@autumn aspen No, thats how you set a role to a guildMember object. READ

#

bot.on("someEvent", (eventName, otherParameter) => {});
@tulip ledge You don't get the eventName as parameter

autumn aspen
#

oh ok

tulip ledge
#

@steep cedar what are utalking about?

earnest phoenix
#

bot.on("someEvent", (eventName, otherParameter) => {});
@tulip ledge so stuff like message and guildCreate work normally without the extra params?

tulip ledge
#

Yes

autumn aspen
#

But I cant find where i setup command so when someones joins it gives a role

tulip ledge
#

eventName should rather be the object you are passed with the event. That is different from event to event.
@steep cedar The name can be flexible like in functions they don't have to be a specific name

earnest phoenix
#

ChickenDev i love chickens expecially those who can use computers

steep cedar
#

@tulip ledge so stuff like message and guildCreate work normally without the extra params?
@earnest phoenix Depends what you want to do. WHen you want to use the content from a message for example you use the first argument.

client.on('message', message => {
  client.log(message);
}

This will give you all information that you have about the message that triggered the function

slender thistle
#

number of passed arguments depends on the event itself but how to name them is up to you entirely

#

console.log you mean, not client.log

earnest phoenix
#

ok so off to docs

tulip ledge
#

client.log

steep cedar
#

@steep cedar The name can be flexible like in functions they don't have to be a specific name
@tulip ledge I know, but calling it "eventName" isn't semantic at all

#

Yeah you can call it whatever you want sure

#

I know that

#

But in this case I thought it was a bit misleading

#

client.log
@tulip ledge ?

earnest phoenix
#

so does guildCreate work without extra stuff?

tulip ledge
#

And you saying it's not a parameter. If you look in the source of discordjs the eventNames are used as parameters and then returned therefor they are parameters

#

Yes

steep cedar
#

Depends on what you want to do

#

Everything works without extra stuff

#

It depends what your google is. If you want to work with the object that fired the function, youll need an argument. For example, when you want to greet the owner of the server that fired guildCreate you will need the first argument (what is the server that fired the event, justa reminder) to find out more about who has the highest perms or has the owner property, for example.

#

THis is a bit complicated for the beginning but once you get it it makes sense

#

Just experiment

earnest phoenix
steep cedar
#

What is that dude

#

MEESUCKS is a great name btw

#

but please move the discussion to #general

earnest phoenix
#

@autumn aspen

#

oh ok

#

hey minimodding lol

tulip ledge
#

If you want to work with the object that fired the function, youll need an argument. For example, when you want to greet the owner of the server that fired guildCreate you will need the first argument (what is the server that fired the event, justa reminder) to find out more about who has the highest perms or has the owner property, for example.
You're just talking nonsense at this point literally 80% of what you said here is wrong

cinder patio
#

The second argument of the on function is a function, and functions can have an unlimited amount of parameters, you can do:

SomeEventEmitter.on("someEvent", (a, b, c, d, e, f, g) => {
    console.log(a, b, c, d, e, f, g);
});

And only the ones provided by the thing that emits the event matter:

SomeEventEmitter.emit("someEvent", 1, 2, 3, 4);

The event gets called, and 1, 2, 3, 4, undefined, undefined, undefined gets console logged.

tulip ledge
#

First of all objects don't fire functions
events !== functions
arguments aren't given by the event as arguments are things you pass to a function
to find the owner you don't have to look at the highest perm

earnest phoenix
#

does this work:

bot.on("guildCreate", guild => {
   guild.channels.create(/*/somestuff/*/);
});
marble juniper
cinder patio
#

Events are exactly that, functions, which get executed at a given point in time.

tulip ledge
#

Yes but an event is not directly a function

#

EVents fire functions

autumn aspen
#

hey minimodding lol
@earnest phoenix HAHHA

slender thistle
#

slpit

tulip ledge
#

Let doesnt work

slender thistle
#

-> split

cinder patio
#

lowercase l

tulip ledge
#

It's case sensitive

compact echo
#

Can someone help me on smth?

warm cloud
#

the man is back again

compact echo
#

lmao

warm cloud
#
        const main = guild.channels.cache.find((x) => x.name === message.author.id)

this looks like a problem

slender thistle
#

Growing tired of this shit already

warm cloud
#

shouldn't you be checking id twice

#

ikr lol

#

just join dapi lmfao

autumn aspen
tulip ledge
#

const main = guild.channels.cache.find((x) => x.name === message.author.id)
You're finding a channel not a user

slender thistle
#

You typed slpit instead of split

warm cloud
#

slpit

slender thistle
#

You typed Let instead of let

tulip ledge
#

You can just do message.author.send(xembed)

#

Instead of finding a channel

autumn aspen
#

oh

tulip ledge
#

As a DM channel doesn't have a guild object

sudden geyser
#

Won't send the eembed or the xembed to the message.author when they dm the bot
That's because your if condition covers the entire code you do (if(message.guild){).

tulip ledge
#

@compact echo

warm cloud
#

@autumn aspen we mentioned that already smh

#

twice

autumn aspen
#

oh

slender thistle
#

honestly don't add up to it please

compact echo
#

That's because your first if condition covers the entire code you do.
@sudden geyser wdym? Just a noob at coding discord.js sry

sudden geyser
#

It's not Discord.js; it's just condition checking. You expect the bot to respond to the user in DMs if they sent the bot a DM in the first place, correct?

compact echo
#

Yes

autumn aspen
#

honestly don't add up to it please
@slender thistle Thx it works

sudden geyser
#

Alright, and in your source code, you do your condition check of if (message.guild) {...}

compact echo
#

Yes

sudden geyser
#

However, that check has the rest of your source code in it. So, if the author sent something, that code inside that if statement would not run, and there's nothing below it.

compact echo
#

Huh

#

hmmm

#

I'll figure that out

#

Thanks tho

sudden geyser
autumn aspen
#

Anyone?

sudden geyser
#

did you forgot to check if the message starated with the prefix

slender thistle
#

are you actually doing anything when you use a command kick

autumn aspen
#

the prefix is !

compact echo
#

lmao

#

Thanks @sudden geyser More helpful than other people

autumn aspen
#

lmao
@compact echo bruh stop

finite bough
#

this is giving me invalid date

#

any idea why? xd

cinder patio
autumn aspen
#

did you forgot to check if the message starated with the prefix
@sudden geyser wdym?

cinder patio
#

come up with your own conclusion

autumn aspen
#

thx!

compact echo
#

huh?

earnest phoenix
#

@autumn aspen you need to check that the command starts with the prefix you put

autumn aspen
#

oki

earnest phoenix
#
ย ย ย ย if (!message.content.startsWith(prefix) || message.author.bot) return;```
#

Like this

compact echo
#

No spoonfeed ๐Ÿ˜ญ

cinder patio
#

that still won't fix his error

earnest phoenix
#

Hmm

#

You did the split wrong @autumn aspen

sudden geyser
#

really the issue is the splitting and not debugging the code

compact echo
#

yea

cinder patio
#

The second element of args is the command name, not the first

#

jeez

#

the first is an empty string

sudden geyser
#

No, it should be the command name

sudden geyser
#

They removed the prefix from the start with substring

cinder patio
#

What's PREFIX tho, maybe it's not "!"?

sudden geyser
#

Well they say it is, but it doesn't hurt to ask.

earnest phoenix
#

How did you set up the prefix @autumn aspen

autumn aspen
#

Lemme shoe u

#

show u

earnest phoenix
#

Ok

autumn aspen
earnest phoenix
#

Nope

pale vessel
#

oh my god

autumn aspen
#

Bro I little hand could be useful

restive pebble
#

bruh

sudden geyser
#

Hold do you have a good understanding of JavaScript

earnest phoenix
#

To set a prefix you need to do const prefix = 'insert here'

restive pebble
#

switch

compact echo
#

Tea

#

yea

earnest phoenix
#

@autumn aspen

autumn aspen
#

yes

#

look

earnest phoenix
#

Thats how

restive pebble
#

js

lyric mountain
#

switch as command handler = ultra massive stonks

autumn aspen
cinder patio
#

.split(" ") should do the job, but now you are making it so the only command that can be used is !kick

earnest phoenix
#

Bro no break

chilly bison
#

use

earnest phoenix
#

Don't do ;

autumn aspen
#

ok

chilly bison
#
.split(/ +,?/);
``` instead
#

^^^

sudden geyser
#

the semicolon is fine

granite nexus
#

lowercase letters would be best as well

earnest phoenix
#

I'm used to not adding a break their so idk if it will work the same

pale vessel
#

Don't do ;
@earnest phoenix wtf?????????????????????

#

sorry

cinder patio
#

Adding ; is a good practice

earnest phoenix
#

Ok

pale vessel
#

especially for inline codes

ornate copper
#

if (err) throw err;
^

Error: Cannot enqueue Handshake after already enqueuing a Handshake.
anyone know why this error exists

pure lion
#

You only have 2 hands

earnest phoenix
#

Lol

autumn aspen
chilly bison
#

you already have thrown an error

pure lion
#

@autumn aspen =

chilly bison
#

@autumn aspen don't use a switch

earnest phoenix
#

@autumn aspen do ' for prefix

digital ibex
#

@autumn aspen learn javascript, please

#

lmao

slender thistle
#

one at a time please

sudden geyser
#

this is such a shitshow

chilly bison
#

@autumn aspen search "js tutorial"

pure lion
#

5 pings

autumn aspen
#

Lmao

pure lion
#

Chill out lmao

slender thistle
#

With multiple people "trying to" help, this shit will go on forever

chilly bison
#

Quoted from the discord.js server

autumn aspen
#

I got 5 coins

earnest phoenix
#
ย ย ย ย if (!message.content.startsWith(prefix) || message.author.bot) return;```
balmy knoll
#

[Javascript] If I use Sets to save data momentarily, the data will follow this format { id: message.author.id, date: message.createdAt }. If I want to use the .has method of sets, how do I check if that set contains data that has the message.author.id as id?

chilly bison
#

Please learn Javascript

earnest phoenix
#

Do that dude

tight plinth
#

^

pure lion
#

Node js isn't a library

#

Neither is JaVaScRiPt

tight plinth
#

Please learn how to use javascript and discord.js before asking ANY question here

pure lion
#

Are you using Eris or djs or djs light

slender thistle
#

node.js is runtime environment
discord.js is a library

tight plinth
#

(if youre using js ofc)

slender thistle
#

y'all need to give up telling them to learn JS

balmy knoll
#

To do what I'm asking not server know the library that is discord.js, but the language

chilly bison
#

djs

tight plinth
#

why star

ornate copper
#

if (err) throw err;
^

Error: Cannot enqueue Handshake after already enqueuing a Handshake.
anyone know why this error exists

sudden geyser
#

Simo a set is like an array but with no duplicates and different methods. If you wanted to work like that, you'd need to check the object (which are all unique so you'd need to get the reference to it)

digital ibex
#

tbh, there should be a role which doesn't allow people accessing this channel if they're just being retarded and stubborn to learn

tight plinth
#

good idea

pure lion
#

Aka mute

tight plinth
#

yea just moot dumb ppl

autumn aspen
#

Do that dude
@earnest phoenix can I change here: *
client.on('message', message => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
^^^^

solemn latch
#

Honestly. Your not helping the guy giving so much help.
He will come to expect people to help if this keeps up.

pure lion
#

@autumn aspen you've been here for hours, take a break

earnest phoenix
#

@autumn aspen that should work i do believe

autumn aspen
#

Bro I guess then Im gonna take a break ๐Ÿ˜”

earnest phoenix
#

If not you should take a break and learn some js

balmy knoll
#

@sudden geyser Ok thanks, the only thing is that when I go to use the set.has method I don't know the value of dates, just the id, so I don't know how to do it. Any ideas?

earnest phoenix
#

This channel is for bot chat, we make this stackoverflow

tight plinth
#

yall should put a system that only allows people who already know JS (or the language they made their bot in) to talk here

ornate copper
#

i just was on stackoverflow @earnest phoenix lmfao

autumn aspen
#

If not you should take a break and learn some js
@earnest phoenix Can we just restart look wait

granite nexus
#

Take a break

earnest phoenix
#

yall should put a system that only allows people who already know JS (or the language they made their bot in) to talk here
@tight plinth agreed

tight plinth
#

why star

restive pebble
#

bruh

earnest phoenix
#

Idk they put it

sudden geyser
#

@balmy knoll you'd need to iterate over it to find it.

pure lion
#

Oooh ooh star this too :D

sudden geyser
#

And with the way sets work, it may be easier to use an array or key/value object

tight plinth
#

erm

digital ibex
pure lion
#

lol

tight plinth
#

Oooh ooh star this too :D
@pure lion as you may know this type of message is not allowed in starboard

#

and dont try to self star

pure lion
#

I do

#

And I know

restive pebble
#

hmmm

chilly bison
#

hahahha

pure lion
restive pebble
#

real star is here

sinful belfry
#

@pure lion please don't ask people to star your messages

balmy knoll
#

@sudden geyser I tried with a forEach, but I had to remove it, since when I find the author's id inside the set, I have to use a return, a forEach ignores returns and breaks.

pure lion
#

Sorry

pure lion
#

OH

chilly bison
#

good job

pure lion
#

Well shit

sudden geyser
#

You could use .values() and use the spread operator to create an array then find it, or you could take the shorter approach and use a for (const x of y) {...} instead (I think).

earnest phoenix
#

star this tkk

digital ibex
#

tf is that url

sudden geyser
#

it isn't wrong

chilly bison
#

@digital ibex a good url

digital ibex
#

says who pog

chilly bison
#

says

#

uhh

pure lion
#

Says me

earnest phoenix
#

how to use emojis in messages. It shows up as plain text for every emoji not just custom emojis

chilly bison
#

@earnest phoenix use slash before emoji

#

for example

earnest phoenix
#

for animated custom emojis that you can't \

chilly bison
#

use the last one

#

animated works too

tight plinth
#

for animated custom emojis that you can't
@earnest phoenix false

#

\:sad:

chilly bison
lusty quest
#

i think you need to be a mod for sending someone on the starboard

chilly bison
#

ez

#

nah

#

its community stuff

pure lion
#

:pandasad:

#

Oh

tulip ledge
#

Is there a way to put the thumbnail of an embed above the fields?

sudden geyser
#

no

tight plinth
#

no

#

wait

tulip ledge
#

Rip

tidal cedar
#

It think it always goes to the side

tight plinth
#

the thumbnail?

tidal cedar
#

The top right corner

tulip ledge
#

No

tight plinth
#

yes, you just define the thumbnail

tulip ledge
#

setImage I mean

tight plinth
#

oh

#

this

#

no

tidal cedar
#

Oh

tulip ledge
#

Sad

tidal cedar
#

No

#

You could do a makeshift things with the footer

#

I guess

autumn aspen
#

Lmao guys quick question, can u do a command so ur bot reacts and responds when a person server boosts?

chilly bison
#

@autumn aspen yes

autumn aspen
#

OwO

#

I swear can I get that command lol

restive pebble
#

hi chicken

tulip ledge
#

Hi

slender thistle
#

You are asking to be spoonfed which we don't allow

restive pebble
#

rule kek

autumn aspen
#

You are asking to be spoonfed which we don't allow
@slender thistle It was a joke

restive pebble
#

epic

tulip ledge
slender thistle
#

Very funny

chilly bison
#

@autumn aspen Listen to the guildMemberUpdate event

slender thistle
restive pebble
#

hmmm

autumn aspen
#

ok srry

chilly bison
#

if the role is the nitro booster role

#

then you know they have boosted

#

ez

autumn aspen
#

oh ofc

restive pebble
#

u can get that premiumSince thing

tulip ledge
#

I still dont get what the point of boosting is

restive pebble
#

i mean use

chilly bison
#

cool stuff

near ether
#

oop one sec

tulip ledge
#

the owners of the discord dont get anything

restive pebble
#

ok

near ether
sudden geyser
#

Are you able to trace what's happening in order for the spike to occur (aka what code is running)

tulip ledge
#

bad code

sudden geyser
#

an example would be an infinite loop

near ether
#

i dont think there are any

#

ive tested my bot extensively and its been running for like 7+ months now

lusty quest
#

its possible that you access an API?

#

(outside of the Discord API)

#

i had the issue that i dont filter out some stuff from the API request. this resulted that the API returned pretty large datapacks (about 2 million entries) this got pm2 to panic and lagged the entire server

#

or did you have a disconnect reovery? if yes limit in pm2 how often the bot gets restarted after a crash

near ether
#

my shards dont crash so i dont have to deal with restarts

#

also i dont use any apis except discords

#

i used to, but i got rid of them

vernal basin
#
whamed = message.guild.members.find(m => (message.content.includes(m.nickname) || message.content.includes(m.user.username)));
whamed.addRole("bunch of numbers");

any reason why this might not be adding the role to the whamed GuildMember?

#

the idea is to find the member that was included in the message, and add the role to them

#

i know the ID isn't the issue, I think whamed might be the wrong type but I don't know why that's happening

lusty quest
#

@near ether maybe a loop that has no defined end?

near ether
#

most of the loops i use are counted loops

#

and the ones that arent are very trivial

lusty quest
#

maybe a timer?

pure lion
#

Guuuuys how do I make an xp bar in canvas

#

I know there's something to do with % fills but uh

#

No idea how to translate the xp value to a percentage

chilly bison
#

@pure lion divide amount of xp by amount of total xp

#

ez

pure lion
#

Oh-

#

Sicccc

#

Can someone link a thing

#

The thing has to be how to add levels to my xp system

surreal notch
#
        { name: 'Servers', value: `client.server.cache.size` },```
Why output is not good
#

ยฏ_(ใƒ„)_/ยฏ

sudden geyser
#

because you set that as the string

#

you didn't use ${} or just not use the backticks.

surreal notch
#

ok

pure lion
#

Also it's guilds

#

:D

surreal notch
#

lol

ruby warren
#

.

compact echo
tulip ledge
#

you're checking if message.guild does not exist

#

And then accessing it?

tight plinth
#

dot copy paste code โ„ข๏ธ

compact echo
#

Huh??

#

I'm confused

pale vessel
#

don't worry about it he was confused

compact echo
#

ok lmao

#

It worked for the guy doing the tutorial

spare mirage
#

@pure lion you love changing ur name dont u?

spare goblet
#

does anyone know if there is any way to have an event listen to boosts in djs v12
or, does it fire a role event when they earn the role from boosting

sudden geyser
#

Well you could listen for new messages then check message.type

#

Which would need to equal USER_PREMIUM_GUILD_SUBSCRIPTION to my knowledge.

spare mirage
#

maybe guildMemberUpdate

#

@spare goblet

tight plinth
#

yeah

#

that works

pure lion
#

@spare mirage .-.

#

*hits roof of car* this xp system is so shit please help me

#
  function xpRand(min, max) {
    min = Math.ceil(min);
    max = Math.floor(max);
    return Math.floor(Math.random() * (max - min)) + min; 
  }

  var guildXPmax;
  var guildXPmin;

  if (guildXPmin == null) {
    experience.set(`xpVal.${msg.guild.id}.min`, 50)
    guildXPmin = experience.get(`xpVal.${msg.guild.id}.min`)
  } else {
    guildXPmin = experience.get(`xpVal.${msg.guild.id}.min`)
  }

  if (guildXPmax == null) {
    experience.set(`xpVal.${msg.guild.id}.max`, 150)
    guildXPmax = experience.get(`xpVal.${msg.guild.id}.max`)
  } else {
    guildXPmax = experience.get(`xpVal.${msg.guild.id}.max`)
  }

  const xpShit = await experience.get(`xp.${msg.author.id}.${msg.guild.id}`)

  if (xpShit == null) {
    experience.set(`xp.${msg.author.id}.${msg.guild.id}`, {
      xp: 0,
      rank: msg.guild.memberCount,
      level: 1
    })
  } else {
    experience.add(`xp.${msg.author.id}.${msg.guild.id}.xp`, xpRand(guildXPmin, guildXPmax))
  }

  if (xpShit.xp > xpShit.level * 500) {
    ++xpShit.level
  }
tight plinth
#

WOA

pure lion
#
(node:16628) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'xp' of undefined
    at Client.<anonymous> (C:\Users\james\Desktop\qBot\index.js:274:14)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:16628) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
#
  if (xpShit.xp > xpShit.level * 500) {
#

the offending line

#

@tight plinth time to delete computer and start over?

tight plinth
#

yes ofc

pure lion
#

great

#

*cries*

kind sedge
#

gets tissue gives tissue to ReferenceError

#

no cri

pure lion
#

can you help me?

#

yes cri

kind sedge
#

what's up

pure lion
#

this totally took me more than five minutes

#

it cant read the property xp of xpShit even though it can read it at my xp command

spare mirage
#

@pure lion where did u define xp?

pure lion
#

its a property

#

if (xpShit == null) {
experience.set(xp.${msg.author.id}.${msg.guild.id}, {
xp: 0,
rank: msg.guild.memberCount,
level: 1
})

#

i wanna make level up but it no work

#

and it doesnt even add to the xp count lOl

lusty quest
#

what database did you use?

pale vessel
#

quickdb

lusty quest
#

idk then

pure lion
#

well fucking shit

#

:DDDDDDDD

lusty quest
#

i never used quickdb so i dont have a idea about the syntax

#

but i look into the code maybe i see something

pure lion
#

dankyou

lusty quest
#

im not sure but its possible that you need to run the Database querys Asnyc

solemn latch
#

honestly, quick.db seems like more work than its worth

#

๐Ÿค”

pure lion
#

omgitswoohe'llsaveme

#

well shit

#

okay

lusty quest
#

with Mysql and mongodb you need to do it

solemn latch
#

any time anyone has an issue, its quickdb

lusty quest
#

ive had some good experiences with Enmap

#

if you need a SQlite DB

pure lion
#

can i use enmap for xp?

lusty quest
#

yes

#

its the website of the creator from the package

pure lion
#

can i store the guild id, the author id, the level, the xp amount, the ceiling and floor andom values and other shit?

balmy knoll
#
await songEmbed.react('1๏ธโƒฃ').catch(err => { if (songEmbed) songEmbed.delete(); return message.react(stop) })
await songEmbed.react('2๏ธโƒฃ').catch(err => { if (songEmbed) songEmbed.delete(); return message.react(stop) })
await songEmbed.react('3๏ธโƒฃ').catch(err => { if (songEmbed) songEmbed.delete(); return message.react(stop) })
await songEmbed.react('4๏ธโƒฃ').catch(err => { if (songEmbed) songEmbed.delete(); return message.react(stop) })
await songEmbed.react('5๏ธโƒฃ').catch(err => { if (songEmbed) songEmbed.delete(); return message.react(stop) })
await songEmbed.react('๐Ÿ›‘').catch(err => { if (songEmbed) songEmbed.delete(); return message.react(stop) })

[discord.js] I use this method to react in a specific order to the same message. I only have one problem, the reaction time between them is very long. I've seen bots that do it much faster, you know how I can solve it?

lusty quest
#

he got a decent documentation and some good explanations

#

@balmy knoll make the first reaction then chain .then()

#

also you cant get it faster, the API limits how fast you can react

#

the same thing we had a few days ago and its API limited

pure lion
#

*cryig*

lusty quest
#

enmap is pretty easy to use @pure lion

#

but needs a lot of ram if you store much data

balmy knoll
#

The speed that there are between the reactions of my bot and those of other bots that I personally use are really very different

pure lion
#

yk what fuck it im moving to sql

lusty quest
#

its possible that other languages dont have the limit from D.js

pure lion
#

im assuming its persistent?

lusty quest
#

iirc the limit is hardcoded into d.js

#

@pure lion enmap?

solemn latch
#

I've seen people show very slow reaction times(much slower than the 1/s of djs).
I've never seen anyone figure out why

lusty quest
#

yes its sqlite

pure lion
#

no, big boy sql

lusty quest
#

yes its persistent

pure lion
#

ok cool

#

any tips before i start?

lusty quest
#

you will cry

pure lion
#

so nothing changes, great

solemn latch
#

I love raw sql tbh

pure lion
#

:D

solemn latch
#

Not for everything

lusty quest
#

if you get the hang of it its easy but getting into it can be annoying

pure lion
#

what do i need to install and shit

lusty quest
#

i used the npm mysql lib

autumn aspen
#

Guys lmao u can use js of single commands why u dont told me it'

#

bruuuuuuuuuuuuuuuuuuuuh

lusty quest
#

?

pure lion
autumn aspen
#

Like ping.js

#

Nothing

#

Lmao

lusty quest
#

i think we told you about command handler

autumn aspen
#

yes but u didnt explain for me how te get it

#

I know thats a word

pure lion
#

okay because i am a lazy i will use quick.db for my previous shit but also use sql because fuck

lusty quest
#

dont mix 2 DBs into one project

#

it can be really annoying

pure lion
#

hhhhhhhhhhh

autumn aspen
#

not for me

warm cloud
#

pogey

pure lion
#

time to make a new bot

autumn aspen
#

time to make a new bot
@pure lion Lmafo

pure lion
#

ill make this one correct

#

not like that alebot poopoo

#

from next week its archived

lusty quest
#

thats normal

pure lion
lusty quest
#

i recoded my bot like 7 times until he got verified

pure lion
#

eyyy

lusty quest
#

but this is how you learn stuff

#

you try stuff until it gets buggy AF, then start new and avoid the mistakes you made last time

pure lion
#

yeah, ill even use a command handler this time

#

with dynamic help

#

:D

lusty quest
#

this is how i learned stuff too, tryed stuff and then wanted to optimize it

earnest phoenix
#

wrong chat

pure lion
#

i know how you feel now :DDDD

#

alright, im gonna remove it from top

lusty quest
#

like i had a command that retrived 25 Items from a API. i made 25 Embed Fields for it, later i made a command that retrived a undefined amount of data from a API so i learned how to Chunk it and made the Embed dynamic. With this knowledge i rewrote the command with the 25 Embed fields, was a good thing

pure lion
#

wait how can you make dynamic embeds?

strange trout
#

paginated?

pure lion
#

is there a way to forEach addfields?

lusty quest
#

i use a for loop for the addField stuff

pure lion
#

okokookokokok

#

i feel optimistic aaaaaaa

hidden lynx
#

Just push the items to fields array

lusty quest
#

i have a array that contains the data i want to display in the embed. with array.length i can define where the loop ends

pure lion
#

maybe ill write it in py this time

#

x)

hidden lynx
#

Just do it with a foreach

pure lion
#

oki doki

strange trout
#

I just chuck it and then generate the page based off the chuck for said page

chunk(array, size) {
  return Array.from({ length: Math.ceil(array.length / size) }, (_, i) => array.slice(i * size, i * size + size));
}
lusty quest
#
 for (var i=0; i<chunked[n].length; i++) {
            embed.addField(chunked[n][i].item, `Place: ${chunked[n][i].place}\n Rarity: ${chunked[n][i].rarity}\n Dropchance: ${chunked[n][i].chance}%`);
              }
``` i have a part of the above this that chunks down a array with a undefined amount of keys (easy 2k keys) down to 10 keys per sub array
#
  async function chunk(arr, len) {

                let chunks = [],
                    i = 0,
                    x = arr.length;
              
                while (i < x) {
                  chunks.push(arr.slice(i, i += len));
                }
              
                return chunks;
              }
```this is how i chunk it down
small hedge
#

How do you get Bot developer role?

pure lion
#

i feel like a proper developer, just for starting over uhmmmmmmmmm

lusty quest
#

@small hedge apply a bot to top.gg

#

if the bot gets accepted you get the role

small hedge
#

Oh

pure lion
#

automatically

small hedge
#

I've been Waiting like a day now I think

pure lion
#

the wait is kllike 2-3 weeks

small hedge
#

Jesus

#

Okay

lusty quest
#

i think its already at 4 weeks

fast glen
#

a day funny

strange trout
#

But for leaderboard command I just use:

await Members.findAll({
    where: {
        guild: this.guild.id,
        level: {
            [Op.gte]: 0,
        },
        xp: {
            [Op.gt]: 0,
        },
    },
    attributes: ['member', 'xp', 'level'],
    order: [['xp', 'DESC']],
    ...Util.paginate({ page, pageSize }),
});
static paginate({ page, pageSize }) {
    const offset = page * pageSize;
    const limit = pageSize;

    return {
        offset,
        limit,
    };
}
pure lion
#

it has been done @lusty quest

lusty quest
#

?

pure lion
#

i am back to not a developer

#

jk

hidden lynx
#

How come?

lusty quest
#

rip

pure lion
#

I deleted my bot

#

Off of top

strange trout
#

Nice

lusty quest
#

i would have made a backup of it

hidden lynx
#

Oh okay

pure lion
#

:D

#

I have a backup

strange trout
#

Do you not version control?

pure lion
#

now i just gotta think of a name

lusty quest
#

what did you want to do with your bot?

#

(this is how i get names for my bots)

hidden lynx
#

Maybe SyntaxError? xD just kidding

lusty quest
#

ive made a auction bot and named him Stonks

fresh kestrel
#

corona!help

pure lion
#

thats perfect

fresh kestrel
#

why my bot got deleted?

pure lion
#

idk

lusty quest
#

he is probably muted here

fresh kestrel
#

no

lusty quest
pure lion
#

what did you want to do with your bot?
WELL THATS COMPLICATED

lusty quest
#

if you have a Idea you can make a name out of it

strange trout
#

My bots name is Rice Ball

lusty quest
#

my bot that got me Verified got a name themed after the game i designed it for

strange trout
#

Has nothing to do with rice balls lol

pure lion
#

i will name my new bot

#

PogBot

#

js

#

no

hasty lotus
#

hey, i've made an interface where you can login and see the servers you can manage online, to after make a web dashboard for my bot, but when i try to display only the servers that the user can manage it returns me this error (in ejs) :

    2| <h1 class="display-3">Dashboard</h1>

    3| <ul class="list-unstyled">

 >> 4|   <% user.guilds.forEach(guild => { 

    5|     var usr = guild.member(user)

    6| 

    7|     if(!usr.hasPermission("MANAGE_GUILD")) return;


guild.member is not a function```
#

would anyone know how i can fix it ?

strange trout
#

Have you looked at the docs

hasty lotus
#

yes i do

#

exactly what i've done

#

but it's not js

#

so idk

#

and it's not a guild of a bot

#

it's a guild of a user

#

so it might be different

#

but idk

#

that's why i'm asking

#

๐Ÿ™‚

solemn latch
#

๐Ÿค”

#

is user UserResolvable
?

autumn aspen
hasty lotus
#

is user UserResolvable
?
@solemn latch well i guess, bcs it's the guild of the user :/

lusty quest
#

limit for deleting messages is 100

hasty lotus
#

it's not bot.guilds.forEach

#

it's user.guilds.forEach

autumn aspen
#

Yes and I did 99?

strange trout
#

Why don't you do that when you handle the route

solemn latch
#

user doesnt have .guilds

autumn aspen
solemn latch
#

which suggests this is custom built

hasty lotus
#

it does work

#

if i remove the condition line it works

lusty quest
#

does it say you dont have permissions @autumn aspen

hasty lotus
#

but it displays all the guilds

autumn aspen
#

No

#

wait

solemn latch
#

so how are you getting user?

#

or well

#

is it one of these types

hasty lotus
#

it's a user that logs in

#

noo

#

it's on a web page

solemn latch
#

then its not user resolvable

#

๐Ÿค”

hasty lotus
#

express server

lusty quest
#

@autumn aspen why MessageFlags?

autumn aspen
#

I didnt have MANAGE_MESSAGES then I added nothing?

#

Idj

#

Idk

hasty lotus
#

the users logs in with passport

autumn aspen
#

It came auto

#

@lusty quest

proven lantern
solemn latch
#

so you cant do user.guild(user)
because (user) needs to be UserResolvable

lusty quest
#

this is wrong use message.channel

strange trout
#
router.get('/servers', require('path to your middle ware'), (req, res) => {
    // Sort out that logic here
    const guilds = req.user.guilds;

    res.render('thing', {
        user,
        guilds,
    });
});
#

You should do it there

hasty lotus
strange trout
#

And then just pass the filtered guilds

#

Then you can iterate over them and make it pretty on the front end

proven lantern
#

@hasty lotus thanks, i'll try that out

hasty lotus
#

so i filter the guilds before sending the page ?

autumn aspen
strange trout
#

Yeah

#

But make sure you fetch the guild

lusty quest
#

@autumn aspen replace MessageFlag with channel

autumn aspen
#

Why is it wrooong!!

#

Ok

opal plank
#

@autumn aspen you dont need return on every statement btw

sudden geyser
#

if you don't want to use if else then you do

autumn aspen
#

I dont have a command handler

#

how do I get one!!

strange trout
#

Make one

autumn aspen
#

How????

#

Pls show me

opal plank
#

bruh

sudden geyser
#

we don't spoonfeed.

opal plank
#

yesterday i sent you 4 links

sudden geyser
#

do you know how to use the fs module

unique shore
hasty lotus
#

but

#

i don't understand

#

in the app.get("/dashboard')

#

i've got this :

#
const baseData = {
                bot: client,
                path: req.path,
                user: req.session.user
            };
            res.render(path.resolve(`${templateDir}${path.sep}dashboard.ejs`), Object.assign(baseData));```
#

what do i need to add ?

opal plank
#

dude

#

stop asking the same questions over and over

#

not you nini

#

holdfizzt

hasty lotus
#

yeah sry

autumn aspen
#

OK

#

oops

#

ok

strange trout
#

first fetch the user guilds because discord oath doesn't give you the entire guild object. Then just filter out the guilds that the bot isn't in and finally filter the guilds that the user doesn't have perms for

opal plank
#

its usually better if you are checking permissions to use final

#

not guild permissions

#

because channel overwrites

spare goblet
#

Well you could listen for new messages then check message.type
@sudden geyser you mean that system message thing? soz for ping

#

o yeah it seems to be system message type

#

ah okei thanks for your help tnc_l_dance

earnest phoenix
#

So i got a play command here i made, the message collector in the middle of the code works fine if you try to queue a song but don't answer in 15 seconds, it will stop the collector and emit the end event, causing it to check if the collected message size is 0 then say you didn't respond in 15 seconds, but... If you queue a song and after this song try to queue a song and not respond, it won't check if it responded or not in 15 seconds, it just continues the session and causes an error ofc
https://pastebin.com/k3UQ82zV

strange trout
#

I'd do guild perms

#

Wouldn't want a member who has perms over one channel to be able to login into dashboard and change settings that affect the entire server

#

Depends though

fast glen
#

There is a lot of JS here. What about some python? I have question about if anybody know how could I make bot leave after being some time inactive?

slender thistle
#

"leave" what

#

a server or a voice channel?

fast glen
#

leave voice channel

slender thistle
#

well there's asyncio.sleep and... hold on let me open the docs...

fast glen
#

ok ๐Ÿ˜„

#

yeah I know asyncio.sleep but I dont know how to implement it into this

snow urchin
#

Ok so I have the following, simple lines of code, why~ when the user aint a verified dev, does it say they are?

const user = message.mentions.users.first() || client.getUser(args[0] || message.author.id),
  guildMember = client.getMember(user.id, message),
  userFlags = user.flags.toArray(), 
 bot = user.bot;
const verifiedDev =  !bot ? userFlags.filter(x => x.includes("VERIFIED_DEVELOPER")) ? client.Constants.Emojis.Badges.Verified.Developer : "" : "";
slender thistle
#

I'm not really sure if it includes the bot itself

earnest phoenix
#

@snow urchin why filter?

fast glen
#

Yeah thats good. I have idea how could I do it. But it would be somehow bad

earnest phoenix
#

Just do
userFlags.includes() @snow urchin

fast glen
#

with some asyncio.sleep

earnest phoenix
#

Wait a second... Why... Is there , after every line...

strange trout
#

wym

#

They're variables

earnest phoenix
#

@strange trout look at @snow urchin code, that is not an object... Only object has , after every line or whatever that even is

slender thistle
#

Yeah thats good. I have idea how could I do it. But it would be somehow bad
@fast glen Which part are you confused on?

strange trout
#
const x = 1,
      y = 2,
      z = 3
sudden geyser
#

Volt the commas are just separators

marble scaffold
#

How do you create a levelling up system?

earnest phoenix
#

monkaHmm interesting

sudden geyser
#

It's short for (based on Alexis example) js const x = 1 const y = 2 const z = 3

marble scaffold
#

Oo

fast glen
#

I was thinking on something like this:
when bot stops playing the function will start. If the bot would still not be playing after some time he will leave.
I have problem with that it will spot some time when the song just ended and person wants to start another song
But I have idea how I could fix this problem

marble scaffold
#

How do you create a levelling up system?
Does anyone have ideas?

strange trout
#

The formatting makes it look confusing

#

@marble scaffold There's lots to a leveling system

#

Does your bot have a database?

marble scaffold
#

Yes

slender thistle
#

when bot stops playing the function will start
A custom event, possibly?

marble scaffold
#

Interesting

fast glen
#

yeah thats what I was thinking about

slender thistle
#

in that event you assign the vc ID to a global dictionary (attached to the client object), sleep for a while, and see if ID is still there

strange trout
#

Do you know about making xp formulas? What type of growth do you want: linear, exponential, logarithmic etc.

slender thistle
#

on play command, you remove the ID from the dictionary

fast glen
#

Yes that could do. I first thought on something like reseting the function but then I found that nothing like this exists in python

marble scaffold
#

I want logarithmic

#

I am not sure about xp formulas though

earnest phoenix
#

So i got a play command here i made, the message collector in the middle of the code works fine if you try to queue a song but don't answer in 15 seconds, it will stop the collector and emit the end event, causing it to check if the collected message size is 0 then say you didn't respond in 15 seconds, but... If you queue a song and after this song try to queue a song and not respond, it won't check if it responded or not in 15 seconds, it just continues the session and causes an error ofc
https://pastebin.com/k3UQ82zV
Ideas?

strange trout
#

It's cool math stuff. Look it up to get a good idea of how they work

marble scaffold
#

Ahh ok

#

Sounds fun

strange trout
#

This has a few good examples

pure lion
#

How do I get a token env from a file named config.env? I've tried process.env.token (defined as token in the .env) but it returns undefined

marble scaffold
#

Ahh thank you

strange trout
#

It's lua but the math is there lol

marble scaffold
#

Yeah lol ๐Ÿ˜‚

rugged fox
#

Hello

earnest phoenix
#

Hi

opal plank
#

need help?

pure lion
#

h

balmy knoll
#
let permissions = channel.permissionOverwrites.get(guild.id);

Why this is always undefined?

earnest phoenix
#

my bot say I'm ready, but i do z!ping and dont work :c

#

the console don't say errors

#

idk why is buged

solemn latch
#

thats not enough info to help

earnest phoenix
#

wtf, my discord is bugged

#

nvm

solemn latch
#

i think permissionsOverwrites.get
uses a role id

#

not a guild id

#

@balmy knoll

balmy knoll
solemn latch
#

well

#

thats confusing

#

yeah

#

๐Ÿค”

#

i guess it is

hasty lotus
#

https://discordapp.com/channels/264445053596991498/272764566411149314/730490034997952523

Just to come back to my question, i searched for some open source web bot dashboard, and i foud the dashboard of the "guidebot" by an idiot's guide (on github), which uses Discord.EvaluatedPermissions like this :

const renderTemplate = (res, req, template, data = {}) => {
        const baseData = {
            bot: client,
            path: req.path,
            user: req.session.user
        };
        res.render(path.resolve(`${templateDir}${path.sep}${template}`), Object.assign(baseData, data));
    };

//other things
const perms = Discord.EvaluatedPermissions;
renderTemplate(res, req, "dashboard.ejs", {perms});```And then this in the ejs file :
```js
<% user.guilds.cache.forEach(guild => { 
    const permsOnGuild = new perms(guild.permissions);
    if(!permsOnGuild.has("MANAGE_GUILD")) return;
  %>```How does this work exactly ? I tried to run the dashboard but it looks deprecated, because of newer djs versions, so i don't know if this is still functionning ^^
#

and please ping me

solemn latch
#

@hasty lotus if you need help with anidiotsguide you should ask in their community.

#

the invite is listed on the website, and probably the github

earnest phoenix
#

TypeError: vCommands.map is not a function - I can't workout what it is triste

solemn latch
#

whats vCommands

earnest phoenix
#

What I'm trying to workout..

solemn latch
#

the line just under that

#

says helpEmbed

#

and likly the line

#

and char position

earnest phoenix
#

@autumn aspen talk hehe

autumn aspen
#

Lol

#

Is it hard?

#

@earnest phoenix

earnest phoenix
#

nah not really

wet dove
earnest phoenix
#

just need to learn some laravel