#development
1 messages ยท Page 1131 of 1
// Note: I highly recommend using a command handler instead which you can find here: https://discordjs.guide/command-handling/
const prefix = "!"; // Set a variable called "prefix" to "!"
const fs = require('fs'); // It opens up the "fs" module. The "fs" module lets you manage files.
const Discord = require('discord.js'); // "discord.js" is a module (https://discord.js.org/) for Javascript that lets you make Discord bots.
const client = new Discord.Client(); // This makes a "client" which would be the "(bot) user"
client.on('ready', () => { // When the bot turns on,
console.log('Bot is ready!'); // Sends the message "Bot is ready!" to the console
});
client.on('message', message => { // When there is a new message,
try { // This checks for any errors
if (message.content.startsWith(prefix) && message.content !== prefix) { // If the message starts with the prefix and the message is not just the prefix,
let cmd = message.content.toLowerCase().slice(prefix.length).split(' ')[0]; // This gets the command name. "message.content" is the "message". ".toLowerCase()" makes the message lowercase. ".slice(prefix.length)" removes the prefix from the message. The ".split(' ')" makes the variable into an array which looks something like > ["hello", "this", "is", "part", "of", "the", "command"] < and "[0]" gets the first part of the array. So it would be like getting only "hello" from the array ["hello", "this", "is", "part", "of", "the", "command"].
if (cmd == "help") { // If the command is "help", (so the message should be "!help")
message.channel.send("Hi."); // The Discord bot replies back the message "Hi."
};
};
} catch(err) { // If there is any errors, it sets the variable "err" as the error.
console.log(err); // This sends the error variable.
};
});
client.login("token here"); // I think you know how to get this. You can get this on "https://discord.com/developers" by creating a new application and making it a bot user.
big spam
Big spoonfeed
complete spoonfeed
giant spoonfeed
ikr

i was bored

Still against rules
(wait it is?)
anyways back to my question? Is there a way to check if the bot reacted on the message with โ ?
that's exactly 2048 characters i think
there probably is some way
#development message just make it loop on a function
Like if the bot was the one who added the reaction when the event was emitted, or who has reacted to it in total
or make the number very long
oof
two
i dont even know if that code above works lmao
if the bot stops
it will reset everything
so i want it to be able to check in case bot randomly crashes
I like how the try block won't even catch anything lol
well i would rather not fill up a database with useless data
i mean i could ยฏ_(ใ)_/ยฏ
but I dont see a point
me well you can make the timer continue after...
bot restart
or something
wait i got an idea
cant you just use the reaction event
im doing that ...
and if the reaction is "โ"
Youd need partials
and the message author is your bot
For non cached messages
it deletes the message
but if the bot itself didnt react on it
i dont want the message to be deleted
you can probably check it somehow
well if the reaction user is your bot (using ids), return;
Which is likly why your author is null
Message.member may also not be in the partials
if the reaction user id is "bot id" return;
i mean that is how our bot does reaction roles
Correct me if I'm wrong, but fetching the message again would give you the author
And all the reactions
hm
it should
Since you only have the partial structure
code?
maybe there should be multiple development channels to prevent cross posting xP
ok waiy
the java script?
const Discord = require("discord.js");
const Collection = require('discord.js');
oh
line 1 and 3
just use the same variable for it
Imagine
{ peepee } = require ('pkg1')
{ poopoo } = require('pkg1')
because Discord.Client() !== require("discord.js")
wdym two
hm
@jolly wave you dont use the collection variable anyways
generally, you should know the basics of python before making a bot
so
๐
the ram,usercount,and servercount,members command are not working
whats with the weird formatting
your a vsc user right?
right click, format document
i can't
holy shit holy shit
also, so many vars
that code makes me cry
yes
dont use var, use let
wtf
ok
only use var if you have a specific reason
indent properly
i can't find it
use a linter
right click
please
ah
no
format document normalizes the way you format for you
infact, once you have this much else ifs it gets hard to read anyways
https://code.tutsplus.com/tutorials/top-15-best-practices-for-writing-super-readable-code--net-8118
i was just trying to make your code more readable
Else if else if else if else if
^ thats the next problem
you should look into switch cases
Ever heard of switch case
wdym
It's fast
nope
And clean
or even a proper full blown command handler
i am not english
command handler is better
Hello not English I am dice
https://www.w3schools.com/js/js_switch.asp
^ switch cases
ok
its always better
let me read it
https://discordjs.guide/command-handling/#command-handling
command handling ^
oh
random pings 
the guide has multiple sections
just writted every other comand in else if
if you follow the guide, it goes on to tell you if else if else if else is bad
I having a problem to invite bots in my server by using mobile and many are
for any more than a few commands
so i can do it for you
Many are heading problem like me
what is your client id
discord is toxic on mobile x)
yap i guess so
its specifically oauth2 on the app
dickord.jsno
everything else works fine
from 1 week i having problem invite bot in server
yeah, im sure discord is aware of the issue and working on fixing it

i still need help
in-app mobile auth was in testing iirc
there is none
From one week I want to contact them but they are not give me reply

didnt we list like 4 things
๐ญ ๐ญ ๐ญ
...
@cosmic kiln 14-27 days is the avarage response for tickets
Now this is frustrating me I can't invite bot I created new server for my friend
you can't invite what
discord mobile app doesnt let you use oauth2
even tho if you open a link on your browser it opens your discord app
@cosmic kiln dm me your client id on the bot app i'll create the link
use browser
@opal plank I used but it is still not working
e
he is not making a bot @jolly wave
@jolly wave ok
he is trying to invite a bot that exists
oooooh
which bot are you trying to invite @cosmic kiln
if that still doesnt work, load the browser in Desktop mode
time to play Minecraft
bro
two things
you confusion what im saying
BROWSER
like chrome
mozilla
opera
chrome sends me to the discord app
not the discord browser
any time any discord link is opened
open in desktop
i dont think android one chrome has desktop mode
but again this page
it was supported a few years back, but not anymore right?
It dods
ANDROID ONE
wrong
not android
are you on android? or android one
tryitandsee
/shru[
its a feature from chrome, im confident it has in whatever platform you using
so this is the place to get a headache, I've only slept for 5 hours so we'll see how this goes

so this is the place to get a headache, I've only slept for 5 hours so we'll see how this goes
@earnest phoenix yes it is
@cosmic kiln First, hold click on the invite link. Then copy link. once you got that, go to CHROME and paste that link in the url bar. Make sure its in desktop site
ya'll overcomplicating this
its not a big deal
How do I check if something happened while trying to fetch API? For example if a user enters an invalid username, how do I check if it is infalid?
yeah, my android one phone doesnt support desktop mode, my s10 does
so the desktop mode solution will not work for everyone
doesnt need to be in desktop
desktop and non desktop
both work just fine
the desktop is just to make sure its not redirecting to the app
Can anyone help with .catch? I was using it originally but it didnโt work for some reason, it only did the error message no matter what
An error*
no shit
you can either do a .catch or a try {} catch{} block
It was in a command that tried to dm a user, but I didnโt want the bot shutting down due to perms
send the code you are trying to catch error
owo cf all
@karmic compass send the code in a bin so we can see it
you got unhandled rejections on strict? 
bold of you
not the WHOLE code
just the snippet of what you trying to catch
Yeah ^
Yooo teaching my gf to code day one
Message.channel.send(โsuccessโ)
}).catch```
you have a gf?
||so you telling me that another porn bot is being produced @pure lion ?||
Uhh
you have a gf?
Why yes
You can't reply to a message
does dm's have channel?
How do you send an embed object in a send method
That's all I'm giving
i forgot if channel exists on dm's
oh then ignore me
if it exists on dm its fine
@karmic compass https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch
Ok
read this to see how catch works
msg.channel.send( embed: embed{ code of embed} );
that doesnt work
how can you send an embed like that
wha
thanks

@earnest phoenix are you using discord.js or eris????
if it is discord.js...
Wait, so if I defined my send message and dm commands in a function, then caught that, would it work?
i got it already but ty
you can just use the embed builder
im stupid
new Discord.MessageEmbed()
I GET IT
embed builders: ๐ฉ
embed object directly on the message: ๐
What I use all the time
const embed = new Discord.EmbedBuilder();
embed.setImage();
embed.setDescription();
channel.send(embed)
// instead do this, rather than making new variables, calling builders, and adding methods
channel.send({embed: {
image: {
url: someUrl
},
description: ':)'
}})
I get the catch a little bit, how would I apply it to grabbing API? If it didnโt show โIdโ, how do I catch that?
i used ember builders like 2 mo. ago, thats how irmb
wdym @karmic compass ?
Like
embed builders can be helpful in a lot of case scenarios
they're just helpers after all. you don't need any helper really
nothing that you just cant assign object
If I went to grab API for a username, and I wanted to check if it was valid, how do I do so?
what the builder is doing is the same you'd be without calling the builder and sending a static object
@karmic compass how is your user being provideD? with args?
or via author?
Yes, via args
so you are trying to do an api call with args
okay next bit
once that catch fails with a rejection, you log ('Falied with '+ arg[0]) for example
since you are doing an api request with the argument, thats your input
Yeah
you dont need to retrieve what argument is being error'ed on the rejection, since you know the input (aka, your argument)
Yes
so, you still dont understand?
not really
okay lets do this
Okay,
https://canary.discordapp.com/channels/264445053596991498/272764566411149314/741675342024147095 im forced to do the second one cuz i use eri- oh wait i can just add require('discord.js') to my code
ew
So:
message.author.send('hi').catch((e:any) => { console.log(e) })
then use { embed: embed.toJSON() }
what is wrong here?
Two why not just create your own builder
that would make it so it would LOG the error itself
i can
Okay so then if I add in another message.channel.send in there to say it failed, it would work?
what is wrong here?
you got that bit @karmic compass ?
Yes
or just ste-- I mean borrow the helper
what's "PREFIX"?
whats not working
so there are another way you can do this
im typing &help and it isnt sending
this for example
sending what
the prefix is &
you never send anything in this code
^
give us your full code
try {
message.channel.send('hi')
} catch {}
preferably excluding token
(dont give your token)
but if you wanna send that you're stupif
this is the same example as the first, there isnt anything being caught
what you can do tho, is tell it what to do with the error
i have it too
nice
(faster than else ifs at least)
try {
message.channel.send('hi')
} catch(err:any) {
console.log(err);
}
can you send full code
i got the command its not sending the message
this is just showing you how you can handle errors/rejections
and not just ss

@karmic compass think you can go from there?
Probably, Iโll ping you if I run into anything
aight
and not just ss
@misty sigil i will send everything that are connected to the prefix
send everything
bot.on('message', message =>{
if (message.channel.type == "dm") return
var args = message.content.split(" ").slice(1)
if(!message.content.startsWith(PREFIX)) return
if(message.author.bot) return;
everything in the message event
Error: Cannot find module './config.json'
why not just send everything you need to send at once
what do you think that means @silver dust
config.json doesn't exist in the same directory
everything in the message event
@misty sigil 500 lines.
hastebin
<client>.users.fetch(<id>)
@sick cloud so i've updated to v12 but this just returns undefined
youve kinda reached the point where command files is beneficial
await it @dense patio
alright
so someone know what to do?
hastebin
youve not given us enough to help
wdym?
then i can see the code
nice, that worked. thanks a bunch
@misty sigil i will send one command.
ok.
i dont mind pings but i mind DM's, so dont sweat about pinging me
oops
someone posted token

oaky so
why its not sending it here?
its giving me an error with err:any
cuz you likely have your token in it @stiff stream
well, you shouldnt copy my snippet
@stiff stream it had an invite in it
oh ok
ik.
cuz its Typescript not javascript
and @gilded plank deletes invites from users without a role
you'll need to remove the invite from that code in order to send it
in Typescript we gotta specify the Type of the variable we are declaring @karmic compass
yeah, fixed that
hey it must be a recurring question but I'm developing a music bot and at the moment the music doesn't end I must have made a mistake but I don't see what I thought you could help me with.
@wanton iron wdym by 'it doesn't end'?
user's dms are closed
see that its blue and not red?
oh
if you dont want the error, just void it
you can just ignore that basically
how would i void an error?
return
this is the coding analogy of picking up the phone then dropping it
there is no sound coming out but the music is still considered as being played and it remains stuck in this state, it's often towards the end of the music.
catch() /*nothing*/ {
//do stuff
}```
@wanton iron are you using something like ytdl?
and are you getting any errors at all?
but lets say im doing API right, and im checking for the part "id", and then it isn't there, is there a way to catch that?
no errors and i'm using this
ah ok
you arent doing anything with API misterdepth
well not right now
you are just doing stuff from emssage object
but back to the "verification" thing
@wanton iron have you set the 'highWaterMark' option?
as this was where i was wanting to go after
well yeah, i remember you saying that
we tgetting ya to understand how to handle rejections first
@sinful belfry nope never heard of that option
oh ok
lemme get something more workable one sec
alright
btw heres my code rn (gives console error but im not logging)
try {
message.author.send('hi')
} catch (error) {
message.reply('a')
return
@sinful belfry nope never heard of that option
@wanton iron ok can you send the code of where you set the ytdl options please?
woah discord thanks for the lit organization
that should get ya a gist of how handling rejections work
@sinful belfry I don't actually set it up, I just use it like this.
a .catch() would work similarly
the options that you set is the bit where you've written 'filter: 'audioonly'
try adding the highWaterMark and setting the value to 1<<25
that's pretty decent, i tried to recreate it here:
try {
theVariable.includes(theVariableIsntAnArray)
} catch {
console.log('AAAAAAA it isnt working')
}```
woops
you now should have 2 examples of how they work
@harsh moon check if rnew is defined
@sinful belfry thanks i'll try
the let rnew should define it
or do I have to do const?
it should though...
just check to see
are you forgetting to await .createRole
await should not be there
why
it printed null and the role is not there @sinful belfry
oopsies is the best error to get
my libs all dont throw descriptive errors, they just say oopsies
ok..
best error is "Oh, no!"
"shit happens"
like this?
because you're making a request to discord's api, you need to wait for the request to be completed and fufilled to ensure the role has been properly created before you can add it to a user
yeah
ok
it needs to be in an async block (if it isn't already)
For example:
Starting money---->$500
After i do work command it plus $50
How to do that?
How to do that?
database
do you have database?
problem
like mongoDB or SQL
do you have database?
@radiant kraken what?
@harsh moon yep, make the block it is in async
Ad im at mobile btw
dont do it
pretty sure you can also set the created role to something and apply it directly
const newRole = await msg.guildcreateRole...
msg.member.addRole(newRole)
And*
without db
???
async function func_name()
so if it is in a function, put async function functionName for example
if not, use quick.db
@earnest phoenix do you know what database is?
@radiant kraken nope XD
its for storing data
@misty sigil not helpful
Oh
even with the bot restarting
So i cant do it?
what library?
you can, implement a database
you can use quick.db
its not a defined function
that is easy for beginners
you can, implement a database
@sonic lodge how?
@opal plank i finally got something to work, i made it so if i want to throw an error in console.log i put (name) and it prints "un oh" in console, otherwise it prints whatever i put in the function!
@harsh moon alternatively, you could just put everything after it into the .then()
@sonic lodge how?
@earnest phoenix there are a lot of database to choose from, like SQL, quick.db, MongoDB, etc
ok
there's lots of ways to set one up too
use something like sql, quick.db (simplest) or mongo
if you're starting i'd reccomend quick.db yea
choose the simplest, duh
choose the simplest, duh
@radiant kraken don't be rude. either help them or don't say anything
Im not good at this
what language
sorry
How??
*mongoose noises*
what language
what language
@misty sigil ??
what language are you developing in
English
Are you js or py or developing a bot in another language for some reason
Gruja what programming language
@sinful belfry im confused
send us some code
Im become confused
and we'll find it out for you
English
@harsh moon the .then needs to run a function
oh
@harsh moon make it redefine a let or something
what language = what programming language is your bot written in
you you can do something like .then(() => {//put code to run here});
This might be long?
AH
javascript
Ok
that was documentation
thats literally stolen from the quick.db docs
what library did you use?
Ohhh
how do I define a function in discord.js?
you you can do something like
.then(() => {//put code to run here});
oh ok
just put the code you want to run inside the curly brackets
that is called an arrow function
Uhh i confused now
and it is run when the rolecreate is complete
ok what language are you developing in
as in programming language
send us code from your bot
how do you look at documentation if your unsure what language your bot is in
Token?
no
no
everything is getting errors ๐
what is your code
Im still 15 and don't know about all of these because i never touch laptop or pc
you cant do catch on nothing
remove the semicolon right before .catch
)
.catch()
k
but you don't know what you're making it on
From yt
On a phone?
On a phone?
@dusky wing yes
fixed it ๐
whats the title of the youtube video
send us a snippet of code.
BRUH
Ok i guess i have to watch it at yt again XD
send us a snippet of code
Gruja do you have a good understanding of the language you're writing in
how many devs does it take to figure out a programming language
on web
3
Hi spech spanish?
what app did you use to code? @earnest phoenix
@earnest phoenix english only in this channel
feel free to speak other languages in #memes-and-media
aah ok ok sorry
can i send someone my code and he will tell me why its not working?
we have asked you to send your code
the function has to be async
like 5 times
send it here
const emojies = {
1: '1๏ธโฃ',
2: '2๏ธโฃ',
3: '3๏ธโฃ',
4: '4๏ธโฃ',
5: '5๏ธโฃ',
6: '6๏ธโฃ',
7: '7๏ธโฃ',
8: '8๏ธโฃ',
9: '9๏ธโฃ',
10: '๐',
thumbup: '๐',
thumbdown: '๐',
cross: 'โ',
nought: 'โญ',
pane: 'โฌ'
};
const Discord = require('discord.js')
const bot = new Discord.Client;
const token = '';
const PREFIX = "!";
const fetch = require( 'node-fetch' );
const { MessageEmbed } = require('discord.js');
const mongoose = require("mongoose");
const moment = require('moment');
const fs = require('fs');
const { type } = require('os');
bot.on('ready', () =>{
console.log('this bot is online')
setInterval(() => {
bot.user.setActivity(${bot.guilds.cache.size} servers | play help, {type: 'WATCHING'});
}, 60000);
})
bot.on('message', message =>{
if (message.channel.type == "dm") return
var args = message.content.split(" ").slice(1)
if(!message.content.startsWith(PREFIX)) return;
if(message.author.bot) return;
switch (args[0]){
case 'test':
message.channel.send("works great!")
break;
}
})
bot.login(token)
aHHH
aandmcpro the error is quite self-explanatory: the async keyword can only be used in an async function
changed it only for now
const emojies = {
1: '1๏ธโฃ', 2: '2๏ธโฃ', 3: '3๏ธโฃ', 4: '4๏ธโฃ', 5: '5๏ธโฃ', 6: '6๏ธโฃ', 7: '7๏ธโฃ', 8: '8๏ธโฃ', 9: '9๏ธโฃ', 10: '๐', thumbup: '๐', thumbdown: '๐', cross: 'โ', nought: 'โญ', pane: 'โฌ'};
const Discord = require('discord.js')
const bot = new Discord.Client;
const token = '';
const PREFIX = "!";
const fetch = require( 'node-fetch' );
const { MessageEmbed } = require('discord.js');
const mongoose = require("mongoose");
const moment = require('moment');
const fs = require('fs');
const { type } = require('os');
bot.on('ready', () =>{
console.log('this bot is online')
setInterval(() => {
bot.user.setActivity(${bot.guilds.cache.size} servers | play help, {type: 'WATCHING'});
}, 60000);})bot.on('message', message =>{
if (message.channel.type == "dm") return
var args = message.content.split(" ").slice(1)if(!message.content.startsWith(PREFIX)) return;
if(message.author.bot) return;switch (args[0]){
case 'test':
message.channel.send("works great!")
break;}
})bot.login(token)
@stiff stream
@harsh moon remove the await
changed it only for now
there is no await though ...
ahH no pls use ```
i recommend put it using the ```
the error is not coming from the snippet you sent
@harsh moon have you saved your file?
const emojies = {
1: '1๏ธโฃ',
2: '2๏ธโฃ',
3: '3๏ธโฃ',
4: '4๏ธโฃ',
5: '5๏ธโฃ',
6: '6๏ธโฃ',
7: '7๏ธโฃ',
8: '8๏ธโฃ',
9: '9๏ธโฃ',
10: '๐',
thumbup: '๐',
thumbdown: '๐',
cross: 'โ',
nought: 'โญ',
pane: 'โฌ'
};
const Discord = require('discord.js')
const bot = new Discord.Client;
const token = '';
const PREFIX = "!";
const fetch = require( 'node-fetch' );
const { MessageEmbed } = require('discord.js');
const mongoose = require("mongoose");
const moment = require('moment');
const fs = require('fs');
const { type } = require('os');
bot.on('ready', () =>{
console.log('this bot is online')
setInterval(() => {
bot.user.setActivity(`${bot.guilds.cache.size} servers | play help`, {type: 'WATCHING'});
}, 60000);
})
bot.on('message', message =>{
if (message.channel.type == "dm") return
var args = message.content.split(" ").slice(1)
if(!message.content.startsWith(PREFIX)) return;
if(message.author.bot) return;
switch (args[0]){
case 'test':
message.channel.send("works great!")
break;
}
})
bot.login(token)
@misty sigil
yes
here you go
PLEASE STOP SPAMMING RON
what is the error?
sorry
hastebin
@sinful belfry my code is saved there is no await I restarted my bot and it throws that err ๐
it is probs from somewhere else then
line 199
apply the same things as what i've told you
Or laptop
it is probs from somewhere else then
console is snorting some real big stuff rn
The console should log the line, no?
is the file saved
Hello a doubt is that I have this code but when putting the prefix in discord it does not take the command, nothing appears neither in discord as in the console
console is high af rn
its discord.js 12 right?
v11
oh

djs v11 is deprecated
what?
its no longer being maintained by the djs developers
and will stop working entirely in october
@harsh moon double check your whole code
new error
just ctrl + f for await
is the role defined?
right above that line i see console.log(rnew)
what does the console.log say before it
in the console it reads null
mhm
and null is neither a role nor a snowflake
@opal plank i found a pretty good way to do the verification, what i did was i had it get the request for the api, and then i checked if(!id) which would say if it were valid or not. i've tested it out, it seems a pretty good way to go right now since i'm not totally getting the hang of .catch
it creates a new default role though ๐
@karmic compass you pinging the api with the user?
seriously console has been smoking pot for the last 2 hours
you need to url encode that
how would this be done?
@sinful belfry it is not working and only creating a basic new role ๐
put the url inside encodeURI()
parseInt and typeOf
parse the argument
then check if its type is number
or NaN it
should also work
@harsh moon what discord.js version are you using?
1.12.2
where would i put this in my code? i think i get it put i don't know at which part to put it in
@harsh moon ah, because your code looks like v11
before you send it to the api, you need to narrow down some cases that would be useless to be trying
use isNaN() to check if the argument is a number
I used v11 but then some kid said that my code was not working because of version
or do the long way i told you with parseInt + typeOf
but then I found out why it was because I was creating the role on the wrong layer
@sinful belfry you got any ideas?
so are you on v12 now?
yes
ok so either downgrade your discord.js version to v11 (which i wouldnt recommend)
or upgrade your code to v12
How do you guys go about your premium commands
this is a great guide
it is v12
your code isnt
your djs version is v12, your code is v11
well how do I update the code?

How do you guys go about your premium commands
@main badge I think people use roles in their support server
https://discordjs.guide/additional-info/changes-in-v12.html
@sinful belfry @harsh moon check this out
Ahh
it should cover everything you need
..
@faint prism thatโs a cool idea
beat me to it
woudl this work: ```javascript
if(!isNaN(args[0)) {
message.channel.send('This is not a valid name!')
} else {
//other code
}
and the old code works fine its the new code
thankyouverymuch
noproblemo
well it doesn't work fine @harsh moon because you're getting errors
the new code does not work fine like I said
for example, the client.users.exists('username', 'Bob'); method is not used any more
all my old commands 100% functioning
If NaN on commands args? Why
client.users.cache.some(user => user.username === 'Bob'); it is now this
(which is covered in the guide)
Never used any of that
so please take a read of it, i promise it will help
What if it's a mention?
he is doing minecraft calls
it wont though because it has no code examples for creating a role ๐
wont work with mentions
<@ID>
it HAS to be type
oh alright
IDK what the command it either. Missing convo context lol
the djs user ID doesnt work for other api's
Finally you didn't ask for spoonfeeding again
in order to test the new system anyone have a mc username they'd like to see the program run with?
Minecraft username???
i dont even know my own minecraft username
yes but that's boring since i've done it already
ngl

wth do I do??? @sinful belfry
nice name
i thought uuid's arent compatible with name
NauticalJeans84

I hope cracked mc usernames work 
if you testing for NaN it wont work if you providing a username
so I just do addRole()?
@harsh moon to use .find correctly
uh
it's giving me an error now
yeah, itll pass the role
your var is called uuid, a username isnt a uuid
then(rnew) => {}
so .find(x => x.name === "Name of role"); for example
i was testing and
i assumed the endpoint you touching is uuid only since your var is uuid
cache
but still, dont even need find
they added cache for all collections or only a few?
is there a wait function for discord.js?
await
but one that I can actually use ๐
why cant you use await?
djs uses promises a lot, you should have a firm understanding of promises before using djs
where do I use it ๐
read the section in the d.js guide about async / await
wait can i just ask a question about async / await
sure
when using await message.channel.send does that mean it will not execute any code after that until it has done that
yes but no
await wont execute anything until the promise resolves
commando allready have aawait action
args: [
{
key: 'text',
prompt: 'What gif would you like to watch?',
type: 'string',
validate: text => text.length < 50
}
]
no need a async i think
well on commando
or most Databases return a promise you have to await
well yeah
if you use then its like awaiting the promise
your using then, rather than await. which is another way to handle async
wow is rl easy commando, mabe a good start for the coders
pretty sure auto-correct won't automatically put autocorret
i dont use commando didnt know about it when i started. And when i knew it exist my knowledge was large enought to not need it
even if using commando, id recommend understanding promises before using djs
what is the worst way to make a command handler
one that doesnโt work
tbh i dont know how to properly write async stuff when i started to code bots until i got into it more
The one I hate the most is case-sensitive if statements that don't have .toLowerCase()
async is kinda a pain, it feels really confusing at first
smh
yep
then, when you understand it, its super simple
oh right
run: async(message, args)
that's why i said smh
smh
one that doesnโt work
@thick gull that's kinda an awesome answer but there are worse command hamdlers
F quote with ping
i have seen people load their commands for every alias, which i think is silly
^ honestly i feel thats the equivalent but with each file being unique
oh and btw does anyone know a good website hosting service that's free?
github pages
but it broke into 6 parts
@opal plank you there or should i stop pinging you now



