#development

1 messages ยท Page 796 of 1

hoary elm
#

@lavish seal if(!message.content.startsWith('prefixHere')) return

earnest phoenix
#

but it's not bad for the reasons builderb said because they're entirely false, it's bad because it's messing up the references to the embed

lavish seal
#

oki thank you

earnest phoenix
#

welp

hoary elm
#

Make sure you put that in a message event client.on("message"

prime cliff
#

Trying to call embed.build() at the start like the red line will lead to an empty embed

quartz kindle
#

thats exactly what i told him

earnest phoenix
#

yea i changed thawt

quartz kindle
#

changed it to what?

earnest phoenix
#

i removed the upper builder.build

#

thats all honestly

quartz kindle
#

so you're sending 3 messages?

earnest phoenix
#

no?

quartz kindle
#

no?

earnest phoenix
#

1 in server and 1 in dms

quartz kindle
prime cliff
#

The first one gets deleted after a delay

quartz kindle
#

its still 3 messages

earnest phoenix
#

then i am sending 3 messages

hoary elm
#

Yeah if he wants one in channel one in DMs shouldn't the ReplyAsync on the last one be irrelevant

#

Seems like he's purposely sending it 3 times.

earnest phoenix
#

@hoary elm this fixed the dms embed

hoary elm
#

Ahh

lavish seal
hoary elm
#

Yes

earnest phoenix
#

But i cant seem to get the code that @earnest phoenix sent to work

hoary elm
#
if(!message.content.startsWith('prefixHere')) return
});```
lavish seal
#

ohh i see

#

ah i have mine set to bot as well rather than client

#

jeez

earnest phoenix
#

that code wasn't meant to work

#

what i sent was just an example of placement

hoary elm
#

And if you are going to define the prefix above it then it would be if(!message.content.startsWith(PREFIX)) return

#

And yeah if you use bot then client won't work

#

Change it to bot.on

lavish seal
#

hmm i keep getting an error when i do this, when i add the prefix without the '' around it all the code lost its colors, then i went down the the errors and removed the prefixes from other areas meant to be sent in a message and the code got its color back

hoary elm
#

Oh yeah

#

No no that's not what I meant

#

See how you have
const PREFIX = "`";

lavish seal
#

yea?

hoary elm
#

That allows you to define the prefix as

#

PREFIX

lavish seal
#

ohhhhh

#

i was thinking of that but wasnt sure

hoary elm
#

Lol

lavish seal
#

cause i thought it had to be a variable

hoary elm
#

So instead of ` with no " just put PREFIX

quartz kindle
#

you cant use bot before creating it

hoary elm
#

Also that ^^

lavish seal
#

oh

hoary elm
#

Put it under where you call the client

lavish seal
#

lemme re order and do as chu guys said

quartz kindle
#

also dont use .on("message") multiple times

hoary elm
#

Yeah that's my bad Tim he only showed me so much of the code so I didn't know he was calling that event already untill now

lavish seal
#

so remove the line in orange right?

hoary elm
#

No

#

Keep it

#

Remove the other one

lavish seal
#

oh

hoary elm
#

Remove the one I made you make I didn't know you were already calling the message event

#

And then add the if(!message.content stuff I gave you to the one in orange

lavish seal
quartz kindle
#

dont just tell him what to add or remove, tell him to think about it logically and explain the reason

hoary elm
#

Yeah like that

lavish seal
#

i see, i didnt even realize

hoary elm
#

Also remove the ' around prefix @lavish seal

#

If you have it as 'PREFIX' then it's gonna think the word PREFIX is what you are trying to ignore.

lavish seal
#

i see

hoary elm
#

if(!message.content.startsWith(PREFIX)) return

lavish seal
#

had another error due to my own mistake of copying the }); down with the line but fixed and it seems to be working now

#

thanks guys

hoary elm
#

No problem ๐Ÿ˜

lavish seal
#

now to attempt to make the bot more fun(?)

#

and break it 100 times in the process xD

#

this is kinda fun though ngl

hoary elm
#

Haha it's part of the process

#

Learning to code is Fun indeed it's huge learning curve

lavish seal
#

broke it before i even added anything xD

hoary elm
#

LMFAO

lavish seal
#

now my embeds arent working

hoary elm
#

๐Ÿ˜ฌ what is the error?

lavish seal
#

theres no error xD, i do the command `Userinfo and nothing pops up

#

or `Help

quartz kindle
#

are you still using multiple message events?

lavish seal
#

uh i might be

#

hang un

hoary elm
#

message.channel.send?

#

Unless sendEmbed is a new thing

lavish seal
#

it was working before like that

#

before making only the one prefix work

hoary elm
#

Hmm I've honestly never seen that before ๐Ÿคท๐Ÿปโ€โ™‚๏ธ ๐Ÿคฆ๐Ÿปโ€โ™‚๏ธ guess I'm just behind lol

quartz kindle
#

i told you not to use multiple. they dont interfere with each other and make your bot work twice as hard: ```js
client.on("message", message => {
// code 1
})

client.on("message", message => {
// code 2
})

"code 1 cannot see or access code 2, and code 2 cannot see or access code 1. they are invisible to each other, and both will be executed at the same time"```

hoary elm
#

He deleted the multiple events..... I think?

quartz kindle
#

from the code you posted before, you were trying to do the prefix logic in one event, and have the commands in another

#

post your full code

#

except the token

lavish seal
#

alright

#

shoot is there a better way to post it?

hoary elm
#

Token should be safe tim he used process.env

quartz kindle
#

pastebin

hoary elm
#

Yeah use

#

Hastebin

lavish seal
#

ah right

#

and yea my token is in the .env

hoary elm
#

Yeah your good then it can't be leaked unless you show us the .env

quartz kindle
#

remove those two message events at the bottom

#

also, whatever guide you're following is very outdated

#

sendMessage and sendEmbed are both deprecated

hoary elm
#

I thought so

quartz kindle
#

you should use message.channel.send for everything

lavish seal
#

oh i see 6 month old youtube guides rn

hoary elm
#

Lol yeah probably outdated

#

What version of discord.js are you using?

lavish seal
#

so basically just delete the stuff after bot.login

hoary elm
#

And yes

lavish seal
#

and uh i think it was 11.40 hang un

#

lemme check

#

oof

#

11.5.1

quartz kindle
#

thats fine

lavish seal
#

that was totally wrong xD

quartz kindle
#

its the current stable version

hoary elm
#

Yeah I use 11.5.1

#

Do what tim suggested

lavish seal
#

alright ill change all those

hoary elm
#

My phone really doesn't like that name ๐Ÿ˜‚๐Ÿ˜‚

lavish seal
#

huh?

quartz kindle
#

lul

hoary elm
#

Everytime I try and type Tims name it auto corrects to time lol

quartz kindle
#

i should change it to Timo

lavish seal
#

ohh

hoary elm
#

Lol

quartz kindle
#

so this server has another Timo

hoary elm
#

๐Ÿ˜‚๐Ÿ˜‚

quartz kindle
#

in fact, people call me Timo irl

#

discord is the only place i started using Tim instead and idk why

hoary elm
#

Interesting I kinda like Timo better

#

Catchier

earnest phoenix
hoary elm
#

What's the issue @earnest phoenix

earnest phoenix
#

talking in vc

#

i was woundering if mongodb had an atomic operator to pause the writing for a certain time

#

instead of having it in a timeout

#

since if the process crashes

#

it wont write

hoary elm
#

Have you tried that? It's their guide for Atomicity and Transactions

earnest phoenix
#

what

#

you mean have i looked int he docs?

hoary elm
#

Yeah

earnest phoenix
#

ebcause atomicity just describes the operators

lavish seal
#

how come when i change one of the .addFields to .addTitle or .Title the embed stops sending?

hoary elm
#

@lavish seal show what you mean

lavish seal
#

same for descriptions and etc

quartz kindle
#

you want to pause writing to the entire db? or you just want to delay a write?

lavish seal
#

it no longer sends

hoary elm
#

Because it's not add

#

It's set

#

.setTitle

#

.setDescription

quartz kindle
#

read the documentation

lavish seal
#

yea thats where i was looking, how did i miss that xD

#

i really must not have been paying attention

hoary elm
#

@quartz kindle in regards to the other guy yes from what I'm gathering he is trying to pause writing completely

#

I'm not that in depth with Mongo yet

quartz kindle
#

well there is db.fsyncLock()

#

but i dont think thats what hes trying to do

hoary elm
#

He said he wanted to pause writing for a set time frame instead of using a timeout function

quartz kindle
#

his code suggests hes trying to save the writing operation outside the process to ensure the writing gets done after a delay even if the process crashes

#

to which there is no build-in function, the only way would be to write a pending status to the db, and have the process resolve past pending statuses on the next read/write

astral yoke
#

Hello.

#

I'm trying to host my bot into heroku, I did the normal commands in git bash of

#

"git add ."

#

"git commit -am "random""

#

"git push heroku master"

#

but, I get this error. I don't know why.

#

If someone can read it for me, please do.

glossy pasture
#

Can I ask about coding problems here?

lavish seal
#

so, i added a mute function and it seems to respond to it a bit like below but it doesnt seem to mute them when the command is used

#
case 'mute':
      let person = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[1]))
      if(!person) return message.reply("Could not find mentions user");
      
      let mainrole = message.guild.roles.find(role => role.name === "Readers");
      let muterole = message.guild.roles.find(role => role.name === "Muted");
      
      if(!muterole) return message.reply("No mute role");
      
       let time = args[2];
      
      if(!time){
        return message.reply("You didnt Specify a time!");
      }
      person.removerolle(mainrole.id);
      person.addrole(muterole.id);
      
      message.channel.send(`@${person.user.tag} has now been muted for ${ms(ms(time))}`);
      
      setTimeout(function(){
        person.addrole(mainrole.id)
        person.removerole(muterole.id);
        message.channel.send(`@${person.user.tag} Has now been unmuted`)
      }, ms(time));
#

im confused why its not adding the mute role and removing readers like it should

hoary elm
#

Any errors?

hushed berry
#

i dont think addrole and removerolle are functions

lavish seal
#

nope no errors

hoary elm
#

I honestly didn't notice that but you are right

lavish seal
#

no? hmm

hoary elm
#

It's addRole and removeRole

#

Capital Rs

#

For role

lavish seal
#

oo

#

i also misspelled a role now i see

#

i dont notice the small stuff

#

sometimes

hoary elm
#

Lol

tame canyon
#

lol

rugged tusk
#

@astral yoke You setted heroku to you remote app?heroku git:remote -a your-app-name

astral yoke
#

mhm

rugged tusk
#

And you need to specify your NODE JS version in runtime.txt. I use Python, but this must be
similar to you

astral yoke
#

like, in my folder?

rugged tusk
#

in the project's root folder.

hoary elm
#

Discord.js would be package.json

west spoke
#

^

hoary elm
#

It's also added something like this I think ```"engines": {

"node": "11"

},```

#

Could be wrong haven't touched that stuff in a while

digital ibex
#

hi

#

how would i make a ping command in eris? Just started

lavish seal
#

What have i done wrong now? i keep getting an error at the very end of the line

 request(options, function(error, response, responseBody) {
   if (error) {
     return;
   } 
    
    $ = cheerio.load(responseBody);
    
    
    var links = $(".image a.link");
    
    var urls = new Array(links.length).fill(0).map((v, i) => links.eq(i).attr("href"));
    
    console.log(urls);
    
    if (!urls.length) {
      
      return;
    }
    
    //Send result
    message.channel.send( urls[Math.floor(Math.random() * urls.length)]);
  });
earnest phoenix
#

go to line and give the code

lavish seal
#

what? im not understanding

earnest phoenix
#

go to the line of the error

#

and give the code

#

on the line

lavish seal
#

its literally this, "});"

earnest phoenix
lavish seal
#

the last bit under message.channel in the code box

earnest phoenix
#

try go were u put this });

#

what start

lavish seal
#

im not understanding again...

earnest phoenix
#

like ```client.on("ready", () => {

})```

#

the end is })

#

and the start is client.on("ready", () => {

#

try to go to the line where the code starts

#

of })

#

wait...

#

i think u need delete the file and restart

#

it affect me too

#

is when refresh the page this will ocurr

hoary elm
#

You also have two open brackets on request(options, function(error, response, responseBody) {

So the end I'm pretty sure should be

);``` or
```});
});```
#

Or if that doesn't work then after responseBody put )) instead of one bracket to close the extra. Like this
request(options, function(error, response, responseBody)) {

lavish seal
#

lemme go and try this then

#

thanks for helping me though

hoary elm
#

Np, let me know if that helps feel free to ping me if you need to ๐Ÿ˜

lavish seal
#

oh damn, didnt realize you responded the second time, thought it was still miguel

hoary elm
#

Lol

visual sandal
#

I keep getting an error for this

client.on(`messageReactionAdd`, reaction, member => {
    if (!member.guild.channels.find(channel => channel.name === "server-roles")) {
        return;
    } else {
        if (reaction.channel.name === `server-roles`) {
            if (reaction === `๐Ÿ’™`) {
                reaction.author.addRole(`Male`);
            }
        }
    }
});
hushed berry
#

would you mind telling us what the error is

visual sandal
#

Lemme push the code and run it, gimme a sec

#

Lol, me being unprepared

hoary elm
#

So it's having a issue finding the channel

visual sandal
#
client.on(`messageReactionAdd`, reaction => {
    if (!reaction.guild.channels.find(channel => channel.name === "server-roles")) {
        return;
    } else {
        if (reaction.channel.name === `server-roles`) {
            if (reaction === `๐Ÿ’™`) {
                reaction.author.addRole(`Male`);
            }
        }
    }
});
#

yes

hoary elm
#

Does the bot have access to it?

visual sandal
#

the code i posted first is outdated

#

ye

hoary elm
#

What permissions exactly does it have for that channel

visual sandal
#

It has admin

hoary elm
#

Okay so that shouldnt be the issue

hushed berry
#

is reaction.guild a property even?

hoary elm
#

Good question actually

visual sandal
#

should i console.log(reaction); ?

hushed berry
#

sure

hoary elm
#

I think it is actually I think it's specifying a reaction in that guild.

visual sandal
hoary elm
#

Cause I have a starboard that uses reaction.message and works fine that way

visual sandal
#

it has all the properties

hoary elm
#

You can try doing what he suggested and do just guild.channels.find(rest of function here or client.guild.channels.find or even message.guild

#

I don't see that being the issue but it could be

#

Message.guild is what I would recommend cause it's already a fucntion the fetches reactions to messages

#

If that makes sense I know I probably could have explained that better

visual sandal
#

k, lemme try

minor kelp
#

I want my bot to update message count everytime a new message is sent how would I do this.
Python

slender thistle
#

on_message event with some bot variable

minor kelp
#

I have that part

#

I also have a variable messages = 0 it should update it everytime but idk how

slender thistle
#

messages += 1? nekopeek

minor kelp
#

I was thinking that

#

it didn't update it

slender thistle
#

Send your code

minor kelp
#

no need

#

I made it work

slender thistle
#

hooray

lavish seal
#

im honestly confused why im getting this error, i installed the packages cheerio and request

#

Parsing error unexpected token

hushed berry
#

@lavish seal probably because of the trailing colon lol

hoary elm
#

should be ;

#

not :

#
image(message);```
lavish seal
earnest phoenix
#

no

#

the second line is right

#

the first line should still be case 'image':

hoary elm
#

yeah the case one was right thats my bad

lavish seal
#

oh....

#

i have spent

#

so long trying to figure this out

#

im gonna commit neck rope

hoary elm
#

Oooof

violet nimbus
#

What I have to type in webhook url?

#

Is that discord webhook?

violet nimbus
#

?

hoary elm
#

You mean on your DBL bot page?

lavish seal
#

now i have math is not defined, and im, again not exactly sure what i did wrong, followed the guide to the tee as it said (i think atleast) installed the correct packages and all

warm marsh
#

Math

hoary elm
#

^ what he/she said

lavish seal
#

wait math is a package?

hoary elm
#

No

lavish seal
#

hurm

hoary elm
#

Uppercase M

lavish seal
#

OH

#

jeez

#

not again

summer torrent
#

it is Math

warm marsh
#

There are packages named math although the methods you're using are part of a default module 'Math'.

lavish seal
#

thanks for pointing that out guys

#

i feellike this is a reoccuring thing

hoary elm
#

You'll get the hang of it as you do it more

warm marsh
#

When did you learn js or are you yet to learn?

hoary elm
#

He's till learning

#

He's still*

#

Been here a few times today

warm marsh
#

Ah well, Good luck!

lavish seal
#

Just realized that anyone can use the commands mute n stuff in the sever

#

glad i didnt add kick/ban xD

copper cradle
#

@lavish seal in the switch statement

#

After case 'something' use : not ;

#

And you gotta be careful with indentation

#

And also add a break; at the end of each case statement

#

Like so

#
let flower = 'dandelion';
switch(flower) {
    case 'dandelion':
        console.log('ah, such a good flower');
        break;
    default:
        console.log('shitty ass flower eww');
        break;
}
marble juniper
#

how can I get the cpu usage in percent in node.js?

#

I want to implement it in my stats command

true ravine
#

I use cpu-stat

#

There is also net-stat, mem-stat and disk-stat if you're interested

#

All from npm

lavish seal
#

im trying to finish my kick/ban commands and then im gonna finally sleep xD

marble juniper
#

@lavish seal you have need to put the else after the if user

#

also you can just remove the else after the if member because the first one is already enough

lavish seal
lilac wharf
#

@lavish seal You are missing a } , insert it at the start of line 171 so it'll be } }

lusty quest
#

is it possible in node.js to set the table name for a mysql database dynamic? -> want the serverid to be the table name

vagrant tree
lusty quest
#

if you do it right maybe

#
    let embed = new Discord.RichEmbed()
    embed.attachFile(attachment);
    embed.setImage("attachment://image.png");``` i do it in this way in one of my commands (its probably more than you want to do) but if you got the image local in a folder you can use a local link
lilac wharf
#

He's asking for python not JS.

lusty quest
#

ohh nvm my bad

lilac wharf
#

all good.

modest maple
#

@vagrant tree gonna be better asking there^^

#

As far as I'm aware you can only attach one file per message

lilac wharf
#

I would say the same thing as you haari-san, one attachment per message, even those including or excluding embeds, which is why when you upload multiple image local files it will send multiple messages instead of just one.

vagrant tree
#

@modest maple thanks

neat ingot
#

how would you handle reporting and things like that when using shards?

#

i mean, i assume not all shards should be sending report information to any api endpoint that might be waiting. would you collect the shard information and then send it from your main file instead?

earnest phoenix
#

@modest maple you can actually still include multiple attachments in one message

#

it's just that most libs don't support it

bitter lark
#

how do i set my bot to have a custom status

earnest phoenix
#

how do i set my bot to have a custom status
bots can't have custom status

bitter lark
#

i meant like

#

a status

#

that tells them what they are doing

#

like

#

"playing in 30 servers"

earnest phoenix
#

so... presence?

#

which library are you using

bitter lark
#

discord.js

bitter lark
#

how do i do it so when i run the bot

#

the status turns on too

lilac wharf
#

there's a discord.js event name called ready (I think).

bitter lark
#

ok

#

so i do this?

#

client.user.setPresence({ game: { name: 'with discord.js' }, status: 'idle' })
.then(console.log)
.catch(console.error);

earnest phoenix
lilac wharf
#

^

bitter lark
#

...

#

but it shows a bad code

#

like error

earnest phoenix
#

oh god

#

help vampire

#

fun

lilac wharf
#
client.on('ready', () => {
  client.user.setPreference({ game: { name: 'with discord.js' }, status: 'idle' });
});```
bitter lark
lilac wharf
#
name: 'with discord.js'```
bitter lark
#

wait ok

#

@lilac wharf says client not defined

lilac wharf
#

client is like your bot thing

earnest phoenix
#

don't spoonfeed code

bitter lark
#

what do i do if it says client not defined

summer torrent
#

define your client

bitter lark
#

how?

#

wym

#

im somewhat a noob

lilac wharf
#

Read the Discord.js docs.
https://discord.js.org/

summer torrent
#

const client = ........

bitter lark
#

?

summer torrent
lilac wharf
#

^

west spoke
#

@bitter lark we can't just spoonfeed you some code. We need things like language, etc.

marble juniper
#

This is not the first time you want spoonfeed

west spoke
#

^

lilac wharf
#

@bitter lark this isn't a learning ground for Discord.js or javascript as a whole, for that you need to read the Discord.js documentations and learn javascript.

quartz kindle
summer torrent
#

it is setPresence @lilac wharf

lilac wharf
#

I was copying his code on that...

quartz kindle
#

lmao

lilac wharf
#

I know what the proper one is I was just leaving it in there, you wouldn't think I would just give out the correct code would you?

west spoke
#

they're smart, NMW03

quartz kindle
#

lmaoยฒ

west spoke
#

they know what they're doing

tight plinth
#

with latest djs v12, how can I detect if a user avatar is a gif or not

#
message.author.avatarURL({format: 'gif'})
```returns a url, how can I check if this url is 'valid'
summer torrent
#

dynamic: true

#

@tight plinth

tight plinth
#

wdym

#

@summer torrent

summer torrent
#

yes?

tight plinth
#

wdym by dynamic: true

summer torrent
#
message.author.avatarURL({dynamic: true})
tight plinth
#

sends the same thing

#

as format: 'gif'

summer torrent
#

oh

#

message.author.avatarURL() returning as .webp. But dynamic:true gives you a correct format

solemn quartz
#

@summer torrent bro

#

@summer torrent are u on?

solemn quartz
#

@summer torrent bro

quartz kindle
#

stop pinging people for help, its annoying

#

if you want help, post your problem and wait

solemn quartz
#

okii

earnest phoenix
#

lul

solemn quartz
#

When i open terminal and i write "node ." the powershell just resets:

#

it says:

#

PS C:\Users\NOPE\Desktop\Super Bot> node .

#

PS C:\Users\NOPE\Desktop\Super Bot>

#

Can someone help me?

#

help plz

copper cradle
#

show your file tree

#

@solemn quartz

solemn quartz
#

?

copper cradle
#

Your file tree

#

Show us what's inside the Super Bot folder

solemn quartz
#

oki

#

i arleady have a screen

#

Muta-unmuta

earnest phoenix
#

muta unmuta

solemn quartz
#

IM italian O K

earnest phoenix
#

youre italian OK

solemn quartz
#

ok

earnest phoenix
#

I'am Turk. OK?

copper cradle
#

Run node index.js

solemn quartz
#

ok

marble juniper
#

imagine not having a shard.js

copper cradle
#

Oof

solemn quartz
#

same thing

marble juniper
#

I have one

copper cradle
#

Weird

solemn quartz
#

like this

#

PS C:\Users\NOPE\Desktop\Super Bot> node .
PS C:\Users\NOPE\Desktop\Super Bot>

copper cradle
#

._.

solemn quartz
#

but whit node index.js

lilac wharf
#

I don't need to imagine it since I already have a shard handler when I'm like 900 servers away @marble juniper 02lul

copper cradle
#

Ah

#

Show us what's inside index.js then

#

Idk why it wouldn't work

lilac wharf
#

without showing the token

copper cradle
#

Ofc

#

run node -V

#

And show what outputs to the console

marble juniper
#

@lilac wharf I made one incase I will ever reach the 2k my bot is on 108 servers rn

#

Gonna be a long road

earnest phoenix
#

@solemn quartz romanian?

solemn quartz
#

v12.14.1

lilac wharf
#

Damn we think so much alike Link...

solemn quartz
#

@earnest phoenix i live in naples

copper cradle
#

Aight so node is indeed installed

#

Show the file

earnest phoenix
#

oK

solemn quartz
#

of what

#

node_modules?

copper cradle
#

index

#

Without showing the token ofc

solemn quartz
#

Wait a min i need to see a thing..

lilac wharf
#

@solemn quartz what's in the index.js file (like the contents of it) without leaking the token

copper cradle
#

^

marble juniper
#

do you have any log lines

copper cradle
#

What ้…’ said

lilac wharf
#

^-^

copper cradle
#

Well ion see any index.js files here

earnest phoenix
#

a weeb!

solemn quartz
#

What should be in index.js?

#

COMMANDS

#

JUST COMMANDS

earnest phoenix
#

:D?

marble juniper
#

We want to see

#

code

#

thats all we need

#

we don't need to know if there are commands inside

lilac wharf
#

Copy and paste the code of index.js

solemn quartz
#

How the fuck can i show u?

lilac wharf
solemn quartz
#

if i copy paste it is toolong

marble juniper
#

my god

earnest phoenix
#

ooF

copper cradle
#

go to hastebin and paste it in there

lilac wharf
#

then click save (top right)

copper cradle
#

then copy the link and send it here

lilac wharf
#

and copy the url

marble juniper
#

or use pastebin

copper cradle
#

yeah

solemn quartz
#

or use pastebin
@marble juniper i was thinking it

copper cradle
#

whatever

lilac wharf
#

hastebin has a better formatting system though...

solemn quartz
#

genius

marble juniper
#

well

#

whatever

#

his choice

copper cradle
#

yeah

#

just

marble juniper
#

and it doesn't even matter

copper cradle
#

send the c o d e

marble juniper
#

the highlighting is visual anyways

copper cradle
#

yeah

#

it's not like seeing the word function in purple or red (like my pee) matters

marble juniper
#

I can just copy paste it in visual studio code for the visual effects

copper cradle
#

I see you're a man of culture aswell

lilac wharf
#

@solemn quartz if you expect us to help we need to see the code that is inside index.js.

solemn quartz
lilac wharf
#

Why do you have a random } on the bot login?

#

Oh wait nvm that's just my eyes being blind

#

That's your issue

#

You are trying to login the bot on the event message

marble juniper
#

you need to do that outside

lilac wharf
#

Take the bot#login(token) outside of that event and just leave it on the outside

solemn quartz
#

?

marble juniper
#

}
})
bot.login(token)

like this

lilac wharf
#

yes.

solemn quartz
#

oh

#

oki

lilac wharf
#

The reason it wasn't working for you is because you were trying to login the bot after registering the message event which requires the bot to be logged in hence it wouldn't work.

solemn quartz
#

FUCK YEAH

#

FINALLY

#

2 days

copper cradle
#

lmaoo

lilac wharf
#

and one line off.

copper cradle
#

^

lilac wharf
solemn quartz
#

2 fucking days to fix this fucking error

#

fucking fucking

lilac wharf
#

I love how I just instantly spotted it by accident because of the random } 02lul

solemn quartz
#

XD

lilac wharf
#

Anyway guess that your issue is now resolved.

marble juniper
#

I spotted it after I scrolled down

solemn quartz
#

YAAAAAAA

lilac wharf
#

I had to copy the code to a hastebin to view it since visuals is a big thing for me

copper cradle
#

now: cOmManD iS nOt dEfInEd

marble juniper
#

nut for me

solemn quartz
#

lol

marble juniper
#

visual is only to make it cleaner for my eyes

#

to make it look better

#

but this code wasn't so long so yeah

lilac wharf
#

I mean but to me I have a big issue with white backgrounds (and reading on them) anyway so I guess that also contributes to it.

marble juniper
#

light theme sucks

#

doesn't matter which site

solemn quartz
#

lol

#

i have purple shades on VSC

#

it is good

marble juniper
#

dis is how mine looks like

lilac wharf
solemn quartz
#

its the normal one

lilac wharf
#

ik.

solemn quartz
#

lul

#

first problem resolved

lilac wharf
#

second problem now?

marble juniper
#

ah shit here we go again

solemn quartz
#

the second is that i fucking need to do a currency system so i will die

marble juniper
#

use a database

solemn quartz
#

quick.db?

lilac wharf
#

use anything EXCEPT JSON

solemn quartz
#

everyone talks about it

marble juniper
#

you can use quick.db sure

lilac wharf
#

I'd suggest MySQL or Mongo.

marble juniper
#

quick.db is basically sqlite for babys@lilac wharf

lilac wharf
#

In my experience I'd suggest using an external storage method which isn't attached to the main server to prevent it from being taken down if you forget to pay for VPS Hosting etc... such as mongo's free 512MB hosting

solemn quartz
#

o.o

#

i cant fucking read that much

#

ima die

marble juniper
#

like

#

what

#

say what

lilac wharf
#

It's happened to a previous bot of mine...

marble juniper
#

in short form: store the data somewhere else execpt your main host

lilac wharf
#

yes. ^

solemn quartz
#

In my experience I'd suggest using an external storage method which isn't attached to the main server to prevent it from being taken down if you forget to pay for VPS Hosting etc... such as mongo's free 512MB hosting
@lilac wharf google translating

marble juniper
#

google translate would have translated that in a much worse way

#

looks fine to me

lilac wharf
#

^

marble juniper
#

what hosting do you use

solemn quartz
#

me?

marble juniper
#

yes

#

who else

solemn quartz
#

node.js

marble juniper
#

no

#

where you run your programm on

#

your index.js

solemn quartz
#

VSC

marble juniper
#

do you run it on your pc

solemn quartz
#

ya

marble juniper
#

or where

solemn quartz
#

lol

marble juniper
#

ok

lilac wharf
#

ouch

marble juniper
#

you should probably get a vps

#

as its better than selfhosting in thousands of ways

lilac wharf
#

you should probably get a vps.

marble juniper
#

yes

#

or a raspberry pi

#

just don't selfhost

#

thats the worst option

solemn quartz
#

wi a vps?

#

what is

marble juniper
#

its the short form for Virtual Private Server

#

its a server where you can run your programms on

#

like your bot

solemn quartz
#

so it gets my bot on and i dont do anything?

marble juniper
#

well you have to set up the server first

#

once you did it tho it stays on 24/7

#

your pc doesn't have to be on

#

its only a few bucks a month

solemn quartz
#

im poor

marble juniper
#

you can selfhost but that requires a good connection and your pc to be online 24/7

#

and that would be like I said the worst option

lilac wharf
#

Just be thankful you aren't doing something like me, Paying $120/year for one vps which hosts the site, backend api and the bot itself on 4gb ram.

marble juniper
#

4gb

#

wooooooomyyyy

lilac wharf
#

I think I might have gotten the price wrong, let me check

solemn quartz
#

i can just close the PC but not turn it off

marble juniper
#

as long as your process stays running

lilac wharf
#

$90/year not $120

marble juniper
#

and your internet doesn't die

solemn quartz
#

wattttttttttttttttttta

marble juniper
#

and your pc doesn't crash

#

and your cpu doesn't die if it is bad

#

and you disk doesn't get filled

#

and your ram is enough

quartz kindle
#

i pay $33 a year

marble juniper
#

sure

solemn quartz
#

is 1/3 of what i spended on fortnite!!!

marble juniper
#

thats bad

#

if you really don't have any choice execpt to selfhost you can try using glitch

solemn quartz
#

i payed 270 eur...

marble juniper
#

but glitch is really bad

quartz kindle
#

270 for what?

marble juniper
#

on the other hand its free

lilac wharf
#

Tim he said on fortnite so cosmetic in-game currencies

solemn quartz
#

270 for what?
@quartz kindle spended on fortnite

twilit rapids
#

I pay 360 euro a year right now

quartz kindle
#

oh lol

solemn quartz
#

and other 50 in roblox

#

elo timo

lilac wharf
#

I pay something like a total of $110/year with all the added extensions like domains, protection etc...

quartz kindle
#

i spent about $30 on videogames in my entire life

marble juniper
#

crazy

lilac wharf
#

Tim you have to be lying... right?

marble juniper
#

100% lying

quartz kindle
#

nope

marble juniper
#

doubt

#

doubt

solemn quartz
#

do you live in Europe?

quartz kindle
#

i do live in europe yes

twilit rapids
#

Alright, this conversation doesnโ€™t relate to development anymore, might want to move to #memes-and-media

marble juniper
#

well like I said

vestal star
#

Haha lol

marble juniper
#

either selfhost

#

or use glitch

#

but you would rather selfhost than use glitch trust me

vestal star
#

or pay $2.50 for vultr

#

also, for what, why do you not like glitch, it runs pretty well

marble juniper
#

it has bad stats

#

when you look at memory and disk space

#

even more memory than disk space

vestal star
#

But, it runs very well. The only thing is that you would have to get a db somewhere else in the cloud

marble juniper
#

it runs very well

#

but

#

stats

#

suck

#

thats just how it is

lilac wharf
#

with?

solemn quartz
#

I have a question

#

how do u make ur bot join this serer if not added on DBL

slender thistle
#

How do you

quartz kindle
#

you dont

#

dont ping people

spare goblet
#

@solemn quartz not possible :^)

#

@earnest phoenix honestly have no idea what your question means so

#

What

solemn quartz
#

so if i add id to DBL it automatically comes in this server?

earnest phoenix
solemn quartz
#

click on the problems

#

and see what is wrong

earnest phoenix
#

these 2 belong together

languid dragon
#

re-read your code and study it, you clearly missed some sort of declaration and have unnecessary brackets

solemn quartz
#

it says "declaration or statement expected", click on it: is it a (,[ or {

spare goblet
#

@earnest phoenix Are you not an English speaker because I have no idea what you mean

solemn quartz
#

u need to know whats wrong

spare goblet
#

@solemn quartz No, when it gets ACCEPTED into DBL, it comes in.

solemn quartz
#

automatically or someone need to invite it

earnest phoenix
#

@solemn quartz the thing that i need to fix are the brackets in rule 38

solemn quartz
#

hmmm

#

try doing this

#

}

#

);

earnest phoenix
#

alr

#

nope

#

btw they could be unnecessary

quartz kindle
#

dont go around blindly adding or removing things. format your code correctly and count your brackets, and you should easily see it

earnest phoenix
#

yeah they were unnecessary

#

idk why

quartz kindle
#

you dont know why because you dont know the language

solemn quartz
#

lol

quartz kindle
#

learn the language

marble juniper
#

this is what happens when you only copy paste but don't understand

glossy pasture
#

@earnest phoenix hey, I noticed you are doing it in on_message, I would suggest getting the commands extension. Makes it way cleaner and easier ๐Ÿ™‚

#

Oh wait, its Javascript. Thought it was python for a sec. Not sure if js has a commands extension

mossy vine
#

it does have d.js-commando

#

but its trash

hoary elm
#

Oof commando ๐Ÿคฎ

mossy vine
#

just write your own command handler at that point

marble juniper
#

making your own command handler is better than using commando

hoary elm
#

100%

glossy pasture
#

Never heard of commando, I use the python commands extension :)

hoary elm
#

Well to give you an example it hasn't been updated in like 2 years

#

That I know of anyways... Atleast not on the npm page

sudden geyser
#

anything is better than using discord.js-commando

static trench
#

I might code a bot in pythonista on ipad

#

Is that a terrible idea?

short siren
#

How 2 host

#

@static trench /\ . You could learn some python but it's best with a laptop as you can have proper text editors etc

tight plinth
#

How can a ytdl-based music bot support yt playlists

earnest phoenix
#

how can i make a shard?

summer torrent
solemn quartz
#

what is a shard?

#

btw im really annoyed rn so can someone suggest me a cmd to add to my bot?

hoary elm
#

Each shard gets a different set of guilds it's more for bigger more popular (1000+guilds) bots, Makes the load easier in a way keeps the bot running fast responding fast ect

#

I hate trying to explain how shards work and what they are lol but ๐Ÿคท๐Ÿปโ€โ™‚๏ธ

solemn quartz
#

lol

hoary elm
#

I'm sure you get the just

solemn quartz
#

btw im really annoyed rn so can someone suggest me a cmd to add to my bot?
@hoary elm u could too just respond to this ._.

hoary elm
#

๐Ÿค” what kind of commands do you have now

earnest phoenix
#

@hoary elm u could too just respond to this ._.
@solemn quartz make a gamble function, more basic commands etc

solemn quartz
#

Ban, kick, Add bot to server link, Profile, server info, help

#

@solemn quartz make a gamble function, more basic commands etc
@earnest phoenix i should do a currency system to do that

#

and that would take a loooong time

hoary elm
#

Profile you could follow that and do like leveling commands

#

Or economy/money

earnest phoenix
#

But your bored soooo... lol

hoary elm
#

Lol

#

Currency system is my suggestion

#

@solemn quartz

#

They are always fun to do. Still have to make a shop command for mine

solemn quartz
#

did u do a basic currency system?

#

so u could help me

earnest phoenix
#

U guys are too good at this lol xD

hoary elm
#

Mines SQL linked

#

100% SQL database (Default Prefix, mod logs channel, currency, ect)

#

But gets denied for the bot list because I forgot to add a NSFW Channel lock or filter to my urban search command ๐Ÿคฆ๐Ÿปโ€โ™‚๏ธ lol sometimes you wonder why you are even doing this when you forget the simplest things

earnest phoenix
#

Where do you guys recommend me to learn the language

hoary elm
#

The guides is a start

#

For discord.js outside of the official docs their is the anidiotsguide name aside it is a decent guide but as always make sure you reference the official guide/and or docs to make sure fucntions ect are up to date

#

JS is honestly pretty simple to learn for the most part even outside of discord

earnest phoenix
#

Yea i kind of know now what most simple lines of code do

#

But i still know very little

solemn quartz
#

@earnest phoenix look at this youtuber

#

i started with him

hoary elm
#

Outside of discord I also make Websites and Scripts/Mods for games and I use JS for most of that stuff.. on top of the normal HTML ect of course

earnest phoenix
#

Yes i am watchin this dude lool

solemn quartz
#

lol

earnest phoenix
#

Im now making the ban command

solemn quartz
#

I can give you the code if u want

#

๐Ÿ™‚

earnest phoenix
#

Yes please

solemn quartz
#

okii

earnest phoenix
#

I am too lazy to type lmao

solemn quartz
#

wait a little

earnest phoenix
#

Sure

solemn quartz
#

case 'Ban':
const banned = message.mentions.members.first();
if(!message.author.roles.find(r => r.name === "Super Bot Master")) return message.reply('No perms message')
message.reply('Succesfully banned message')
banned.ban('User Banned By A Staff Member By BOT NAME ')
break;

#

i did like this

#

u need to customize it

#

if ur not an idiot u will edit it

earnest phoenix
#

can you pls send the kick command aswell? ;-;

solemn quartz
#

...

#

wait a sec

#

BUT

#

U NEED TO PROMISE ME A THING

#

U will fucking learn how to do this FUCKING commands by U

#

ok?

earnest phoenix
#

how would one make a simple mp3 player using the voice chat?

solemn quartz
#

idk

earnest phoenix
#

@solemn quartz so i need to code it on my own?

solemn quartz
#

no

#

i will send u

#

BUT U WILL NEED TO STUDY IT

earnest phoenix
#

hmm

solemn quartz
#

pls

#

im doing u something good

earnest phoenix
#

i hope i have enough braincells

hoary elm
#

He's saying it's not going to be production ready you have to edit before it will work ๐Ÿ‘Œ

earnest phoenix
#

alr

solemn quartz
#

case 'Kick':
const kicked = message.mentions.members.first();
if(!message.author.roles.find(r => r.name === "Something like admin or bot master idk")) return message.reply('No perms')
message.reply('User Kicked Succesfully')
kicked.kick('User Kicked by a staff member by BOT NAME')
break;

#

Wait

#

i ve messed up

#

OK now good

earnest phoenix
#

here we go

#

biggest challenge yet

solemn quartz
#

lol

earnest phoenix
#

oh gawd

solemn quartz
#

it doesnt work?

earnest phoenix
#

well it probably does

#

but i have some errors

solemn quartz
#

Test it

#

naaaaaaaaaaaaaaaaaaaaaaaa

earnest phoenix
#

like 2 errors

solemn quartz
#

lemme see

#

im helping u instead of playing wit my new spypeely skin on fortnite >:c

earnest phoenix
#

lol

#

ok so i need a declaration for case

#

the very start

solemn quartz
#

lemme see

#

screen

#

dont show token

earnest phoenix
#

alr

#

It is a : not ;

solemn quartz
#

its just a pixel image

earnest phoenix
#

visual studio said ;

solemn quartz
#

Nope

#

its :

earnest phoenix
#

oh okay

#

Your are putting it oustide of a switch too

solemn quartz
#

ive thinked that was cuz he didnt say break; at the end of the last cmd

#

@earnest phoenix btw change "Super Bot Master To like Admin or bot master idk

earnest phoenix
#

yeah

solemn quartz
#

that means that who havethat role can use mod commands

earnest phoenix
#

okay

solemn quartz
#

copy paste that line in every mod cmd

#

ive did like that

#

@earnest phoenix btw when u need my help ping me cuz im lazy

lusty quest
#

i miss something here but idk what.

#
    let sql = `SELECT `+table+` FROM Serverconfig."`+database+`"`
    connection.query(sql, function (err, result, fields) {
      if (err) throw err;
      console.log(result)
     return result
    });   
}``` i try to get the result but its always empty
#

the console log in the function contains the data i wanted

hoary elm
#

what are you trying to do with ```js
return result

lusty quest
#

i want to use the data i get out of the function in a command

#

its for a per server configuration and currently i want to set the prefix from the config. got it already with enmap working but want now switch to mysql in case i need sharding

quartz kindle
#

you cannot return a result given to you in a callback

#

not like that

lusty quest
#

sorry for that most of my knowledge is from error and trial and reading docs

quartz kindle
#
    getData(result => {
      // result is available here
      // returning here does nothing because the result is not returned in time
    })
    // result is NOT available here
    // the function exits and returns undefined
    // the getData part does not wait
}```
lusty quest
#

so making it async could help? or did i get this part wrong?

quartz kindle
#

this is how it works:
you call getData, and the code sends it to a temporary place until the result is available
meanwhile the code continues
once the result is availabole, the part inside the return scope continues, at this point, it is completelty independent from the function which already returned

#

there are two solutions

  1. put all the code that depends on the result inside the block where result is returned
  2. wrap the getData function inside a Promise, and then await the promise
#

here's an example of how to wrap a function in a Promise:

#
function something() {
  return new Promise(resolve => {
    getData(result => {
      resolve(result)
    })
  })
}```
#

then you can use it in an async function like await something()

lusty quest
#

ok thank you

earnest phoenix
#

@solemn quartz i got it working !

solemn quartz
#

np

earnest phoenix
#

feels like an achievement lmao

solemn quartz
#

lol

tight heath
#

I did a thing

#

:o

tranquil copper
#

Does anyone know how to sort this list in java by the first number only?

Unsorted: [0i218970213574508555, 1i425357961196470292, 0i201850930121932801, 0i466966675183370268, 0i668827593591750675, 0i330117785776685068, 7i509279793926111242]
#

note: the value of the list are strings

quartz kindle
#

java or javascript?

tranquil copper
#

Java

#

do you know how i have to do this. Because i need a working leaderboard for my idle bot. The first number is the level of the user. The i is just for seperating the 2 values later on. and all after the i is the memberid.

short siren
#

@earnest phoenix You forgot a switch statement and it's not in an event oof

quartz kindle
#

i dont use java so idk, but there should be a sorter function

tranquil copper
#

yeah but it sorts the list as string so 0 to 9 is perfect but all above 9 is sorted beyond 1

quartz kindle
#

yeah what i mean is a sorter function where you can pass your own parameters and comparators

earnest phoenix
#

sa

#

@earnest phoenix, As

quartz kindle
#

for example, javascript has this: js array.sort((a,b) => a.split("i")[0] - b.split("i")[0])

earnest phoenix
#

Tรผrk varmฤฑ

grizzled raven
#

you know

#

you could just do a[0]

quartz kindle
#

it sorts by splitting the items by the i and comparing the first part

grizzled raven
#

star eval silent message.author.send("string"[0])

quartz kindle
#

no because the number before the i can be bigger than 9

#

ie 34i824823043720

grizzled raven
#

oh yeah true actually

bitter lark
#

who wants to make a discord bot with me?

tranquil copper
#

wich coding languagew

bitter lark
#

discord.js @tranquil copper

tranquil copper
#

ima hell out haha

bitter lark
#

@tranquil copper i can do another language

tranquil copper
#

im only coding bots in java with bungeecord interface

bitter lark
#

@tranquil copper i can do java

tranquil copper
#

wich type of bot and what for features?

#

does anyone knows how to split a string every 4 characters with an i ?

#

or - like an uuid in java?

round ridge
#

Hello i need help with phpmyadmin/MariaDB witch i use for my discord bot

So i had error:

 #1932 - Table 'dominik_modbot.blacklist' doesn't exist in engine

And i found out that its mysql corrupted file called ibdata1
And could someone could help me how can i fix this i got rly important data that are in the db but cant access by this error

modest pendant
earnest phoenix
#

overwrite the css classes in your bot description

zenith orchid
#

@modest pendant write css for html tags on the page.

earnest phoenix
#

thank you for saying the exact same thing

modest pendant
#

alright thx

#

you too @zenith orchid

zenith orchid
#

Messages come late.

#

And suddenly

#

I think my connection

glossy pasture
#

Nope

#

I got the message from cry at the same time as you

true ravine
#

What is the best way to get rid of dependencies I'm no longer dependant on?

#

Do I just remove them with npm and delete them from my package.json?

marble juniper
#

sure

#

go to the node modules folder and delete the folder with the module you don't want anymore

true ravine
#

Alright thank you very much

marble juniper
#

and remove it from the package.json

true ravine
#

Yeah thank you

quartz kindle
#

you can use npm uninstall lib -s

#

the -s makes it save the removal and update your package.json

#

otherwise it will be uninstalled but not removed from package.json

cinder patio
#

@quartz kindle I remember you saying that you've written a node.js discord library without caching? May I have a link to the github page?

quartz kindle
cinder patio
#

thanks

vagrant tree
#

hi, when using wait_for (I am using python) i am really struggling to make sure i only wait_for the last wait_for entered by a user. how can i make sure it stops wait_for previous wait_fors?

modest maple
#

your gonna need to send le code xD

vagrant tree
#

ok... but its pretty ugly

#
def check(m, u):
            try:
                print(m,u,ctx.message.author,m.message.channel,m.content)
                return u == ctx.message.author and m.message.channel == ctx.message.channel and int(m.content) > 0 and int(m.content) < 11
            except:
                print('failed...',m.content)
                False

        try:
            if ctx.message.author in pending_tasks:
                pending_tasks[ctx.message.author].close()
            pending_tasks[ctx.message.author] = bot.wait_for('message', timeout=300.0, check=check)
            message, user = await pending_tasks[ctx.message.author]
        except asyncio.TimeoutError:
            await ctx.send('Timeout')
        else:
            await ctx.send('Cool, thanks!')
#

some of this code is based on a stackoverflow answer

modest maple
#

i noticed

#

idk why u have a random False statement floating around

vagrant tree
#

woops that should be return False

#

the error im currently getting is TypeError: check() missing 1 required positional argument: 'u' which is in my check i think

#

however i feel i might be barking up the wrong tree here

modest maple
#

cuz you only getting the message object

#

you dont get anything else

#

the 'message' event is exact same as on_message

#

you only get the same stuff as you do the normal avent

vagrant tree
#

can i drop the u,m and just use ctx.message. ? i am a little lost

modest maple
#

you just get passed message

#

so drop the u

#

keep the m

#

you get the user object from message object

#

which is message.author

vagrant tree
#

is m.message.author the same as ctx.message.author?

modest maple
#

no

#

m is the same as message

#

so message.author would be m.author

#

youre just changing the var name

vagrant tree
#

what is ctx.message.author?

modest maple
#

ctx is just context

#

its just a context object

#

it just saves you having todo message.send, with ctx you just do ctx.send

vagrant tree
#

thanks, i dont think i fully get it but i think i have enough to make some changes and continue

vagrant tree
#

ok i have gotten through the check, but now i am getting this error: py message, user = await pending_tasks[ctx.message.author] RuntimeError: cannot reuse already awaited coroutine

#

although im unsure whether it is meant to throw that error

modest maple
#

that gets thrown if the thing its calling has already been awaited

#

meaning its already been sent off as a future task

vagrant tree
#

so the except except asyncio.TimeoutError: await ctx.send('Timeout') is intended for that error?

modest maple
#

no

#

that only catches the Wait_for() function raising a timeout exeption

#

what happens if u remove the await from await pending_tasks[ctx.message.author]

vagrant tree
#

so if i execute the initial command twice i get this error message, user = pending_tasks[ctx.message.author] TypeError: cannot unpack non-iterable coroutine object

#

now after removing the await

modest maple
#

what is pending_tasks

vagrant tree
#

its a dictpending_tasks[ctx.message.author] = bot.wait_for('message', timeout=300.0, check=check)

modest maple
#

show full code again

#

also use author IDs not objects

#

cuz somtimes causing caching issues

vagrant tree
#
def check(m):
            try:
                return m.author == ctx.message.author and m.channel == ctx.message.channel and int(m.content) > 0 and int(m.content) < 11
            except:
                print('failed...',m.content)
                return False

        try:
            if ctx.message.author in pending_tasks:
                pending_tasks[ctx.message.author].close()
            print(pending_tasks)
            pending_tasks[ctx.message.author] = bot.wait_for('message', timeout=300.0, check=check)
            print('completed check!!!')
            message, user = pending_tasks[ctx.message.author]
        except asyncio.TimeoutError:
            await ctx.send('Timeout')
        else:
            await ctx.send('Cool, thanks!')
modest maple
#

ah

#

ah okay

#

i get this now

#

right

#
  1. pending_tasks[ctx.message.author] = bot.wait_for('message', timeout=300.0, check=check) will work but you cant call a coro without awaiting it unless your saving the future object to a var to be awaited later which causes blocking and ahhhhhhhhhhhhhhh

  2. Check is only called on the message event, The message event will only happen when the wait for is awaited so you cant assign a coro object then try to unpack it after

#
 if ctx.message.author in pending_tasks:
                pending_tasks[ctx.message.author].close()
            print(pending_tasks)
            pending_tasks[ctx.message.author] = bot.wait_for('message', timeout=300.0, check=check)
            print('completed check!!!')
            message, user = pending_tasks[ctx.message.author]```
#

seems a little unessesairy

#

like


message = bot.wait_for('message', timeout=300.0, check=check)

would be enough

#

its litterally doing the same thing according to that check

vagrant tree
#

i see

#

let me try that

lavish seal
#

Set up a ban command but im getting
if (user) {
^
ReferenceError: Cannot access 'user' before initialization

What did i do wrong?

      case "ban":
      
      const user2 = message.mentions.users.first();
      
      if (user) {
        const member = message.guild.member(user);
        
        if (member) {
           member.ban({reason: 'You were misbehaving!'}).then(() =>{
               message.reply("user has been banned!")
           })
        } else {
            message.reply("That user isn\'t in this guild")
        }
    } else {
        message.reply("You must Specify a User!")
    }

    break;
summer torrent
#

what is "user"

lavish seal
#

AH, nevermind i messed up and made the const user2 cause it was already declared for the kick command but i never changed the other (user) to user 2

#

changed it and its fixed now