#development
1 messages · Page 881 of 1
I've à Light prob
@digital ibex i think that there’s different ways to do it : by exemple instead of if (msg.content === PREFIX + "command" you should use msg.content === "?command"
That's not how it works lol
with ? as the special prefix
so
i got dis
let prefix;
if(message.author.id === '475371795185139712') {
prefix = guild.prefix || ';;' || ';'
} else {
prefix = guild.prefix || ';;'
}```
no
The third one doesn't work
but that isn’t correct
what
I want create my bot, but knowing nothing yet, and i want create a room for all bots and commands
r u gud
In let statement... You can only put 2 values

It doesn't check for the 3rd value
like prefix = ["?", "!"] prehaps
@spice smelt nope i tried that... That's not possible
@knotty sundial YouTube is your best friend if you know nothing at all.
Also if you want to create a bot... The best Library to start with is discord.js @knotty sundial
Yes you rezdon bri

um
Hmm... If you want to start creating a bot you should watch a tutorial in yt... And come here when you're having any development issues with it @knotty sundial
prefix can't be an array
True that
Right, im happy to your understanding, czn we doing a group ?
Nah because it would take way too long for me to teach you how to create a bot
Yes
no
or StackOverflow
yt tutorials are WACk
what is problem
Do you have chznnel pl
its a discord channel
YT tutorials overall are a bad idea to get into Discord bot making
Youtube tutorials are outdated tbh
yes
But they can make discord bots from YouTube and come here whenever there's a problem so we teach them how to solve
You're prone to find old videos that won't work by the time you find them
there aren't much eris tutorials but
Alright
K, what's the Best so,
djs
(Don't tell me none of you started making discord bots with watching YouTube tutorials first)...
discord.js is kinda the best ngl
i agree
I got started with very little knowledge of Python by modifying Red bot
Never used YT as reference
ok what is the problem
@slender thistle 
Yes but jzva, html and more =40pct for me
i used to watch 2, menu docs and the source code
YT isn't a universal solution to everything fyi
imagine making a bot in html
XDDD
90% of tutorial videos show bad practice
We know it's not a solution to everything but at least it helps
what a nice idea
especially with discord bots
How do outdated videos help
they try to simplify something that just isn't simple at the base and that causes bad code and bad practices
i was going to start a good eris tutorial
@slender thistle i mean just to warm up and start up getting better... Not to just teach you the exact better way
covering like a custom handler and shit
excuse me but what’s eris ?
A library
discord.js just not shit
How do you get better if you follow an outdated tutorial
Uhh

@slender thistle i said to warm up lol... And after that get better by asking updated help out there or using stackOverFlow
Lel
SO isn't good for Discord API wrappers either
I want create a event with you ?
excuse me what
Anyway this turned into #memes-and-media ... Can we get to problem solving please?
You might only get a very vague gist of how a Discord bot is made in X library, but that's about all you'll learn.
Thank you for enjoy
youtube tutorials are only good for the basics of a language
Where can you gonig for speeking ?
anything more and they become a hinderance
@modest maple yea that's what i've been trying to explain
Just to learn the basics
Lol
people should learn how to read docs just after learning the basics
so voltrex uh
Yea?
i disagree @modest maple
ALL and It’s the ifferent prices
Anyhow, let's get back to solving things
Reading docs after learning basics is not a good thing tbh
i mean yes it is
Because you're a beginner and not know how to solve issues with docs
you should
some people find it hard to read some docs, like me, i can't read djs docs for shit
Lol
if you've learnt the basics you should know the terminology to describe everything
OK
Hmm
i can read eris and mongoose
Let's get to solving issues shall we?
they're the only 2 i've actully thingiesd
kk
ok uh
i have this
let prefix;
if(message.author.id === '475371795185139712') {
prefix = guild.prefix || ';;' || ';'
} else {
prefix = guild.prefix || ';;'
}
but it doesn't work with ;
like i do ;ping
no response
i do ;;ping
response
That ;; you put there will work not the ;
yes
or if guild.prefix exists
also works with guild.prefix
Thank you @everyone, i bzck please let me a grad for our project please, good job guys
@digital ibex so do you want ;; or ; as your special prefix?
what
';;' || ';' is always going to be the first one
Since ';;' is not a false-y value
@slender thistle but they aren't the default prefix
Just default prefix and one special prefix
@digital ibex
if(message.author.id === '475371795185139712') {
prefix = guild.prefix || ';';
} else {
prefix = guild.prefix || ';';
}```
You can change that ; to ;; if you want
whats the point in that check then...
Uhh what
prefix = guild.prefix || ';'; is the same as prefix = guild.prefix || ';'; the line bellow it
similar to js if (x) y = 5 else y = 5
Oh he put that ; below there as a mistake lol
oh
you dont even need that if statement
its just redundant code
https://discordapp.com/channels/264445053596991498/272764566411149314/701723728991485952 in that example that is
@digital ibex
The one below needs to be:
prefix = guild.prefix; only
yes
what i want for only me:
guilds prefix & ; as the prefix
else
guilds prefix
so i got uh
if (message.author.id === '475371795185139712') {
prefix = guild.prefix || ';';
} else {
prefix = guild.prefix || ';;';
}```
No
For others?
thats where i am confused
guild.prefix is the prefix for everyone and ; just for u
if (message.author.id === '475371795185139712') {
prefix = guild.prefix || ';';
} else {
prefix = guild.prefix;
}```
Yea correct
Wait why?
because if there is no prefix then?
Oh it's because there's no
let prefix; on top?
there is
are you sure we can put multiple value to 1 variable ?
thats y i have let prefix = guild.prefix || ';;'
@spice smelt yes but only 2
that’s surprising i didn’t know
so can i do
let oof = ';;' || ';';
if (message.author.id === '475371795185139712') {
prefix = guild.prefix || oof
} else {
prefix = guild.prefix || ';;';
}
or uh
is that wrong?
Hmm TRY IT AND SEE...
ok
btw i have a question too
add ur bot to dbl
@earnest phoenix have a bot approved in dbl
(im asking it because i can test it right now) what happens if the bot tries to delete a msg but cant because it hasn’t the perms? is this a fatal error?
i send my bot but my bot waitin approv
Depends on how your code/library handles 403 error code
@spice smelt no it just sends a normal basic error to your console.log
Usually it shouldn't crash your bot, though I suggest handling them anyway
It's good practice to try-catch stuff that can raise errors
I literally get the Missing Permissions errors every day on my console.log
So it's common
Np
when my bot approv
-faq 2 -c
in about 2-3 weeks @earnest phoenix
doesn't work, no errors
Hmm can i see your code?
let prefix;
let oof = ';;' || ';';
if (message.author.id === '475371795185139712') {
prefix = guild.prefix || oof
} else {
prefix = guild.prefix || ';;';
}```
That oof needs to be above the let prefix;
why?
@spice smelt uhh...

Huh
let prefix;
let oof = ';;' || ';';
if (message.author.id === '475371795185139712') {
prefix = guild.prefix || oof
} else {
prefix = guild.prefix || ';;';
}```
Uhh
it didn't message me
¯_(ツ)_/¯
Oh lol
i just sent that and i got dmmed
can someone else send the block to see if it DMs someone else
Something might have went wrong in the bot code i think
let oof = ';;' || ';';
if (message.author.id === '475371795185139712') {
prefix = guild.prefix || oof
} else {
prefix = guild.prefix || ';;';
}```
Nope
let oof = ';;' || ';';
if (message.author.id === '475371795185139712') {
prefix = guild.prefix || oof
} else {
prefix = guild.prefix || ';;';
}```
Nope
¯_(ツ)_/¯
Mm
Oh... The pl is It's prefix lol
mb
It sent a dm to me too lol
so uh, voltrex, u got any ideas?
@digital ibex ideas about what?
how i can get my own prefix to work only for me and no one else
and me still work for the guilds prefix
Hmm i gave you the code tho
Did you move oof let statement above let prefix;
?
K
Hmm what's guild.prefix as defined as?
this is guild
let guild = await guildS.findOne({ id: message.channel.guild.id });
and thats for the db
and guild.prefix is for the thingy
uh
prefix for the guild
That message.channel.guild.id can be message.guild.id tho
Yes it can lmao
not for eris
Wait is that for eris?
So you've been writing my code in the eris library?
That would not work lol
Every library has it's own differences
its the same for djs and eris, the code u gave
Hmm really?
some similarities
is there message.author.id in eris?
That code snippet isn't exclusive to Eris as you're not interacting with the library at all
yes
just note that || doesnt work like that

its- the only library thing in that code is message.author.id
Hmm
let prefix;
let oof = ';;' || ';'; // will always return ";;"
if (message.author.id === '475371795185139712') {
prefix = guild.prefix || oof // these 2 return the same thing
} else {
prefix = guild.prefix || ';;'; // these 2 return the same thing
}
Wdym these 2 return the same thing?
basically what you are doing is ```js
let prefix = guild.prefix || ";;"
Yea because both are having the same results
that whole code block id equivalent to my line
confusion: how 2 make prefix 4 me?
like
i don't want other people to use it apart from me
if (message.author.id === '475371795185139712') {
prefix = guild.prefix || 'special prefix for yourself';
} else {
prefix = guild.prefix;
}```
it won;t wotk
like i said lol, if there is no guild prefix then
¯_(ツ)_/¯
whats the prefix?
thats y its prefix = guild.prefix || ';;';
Hmm... You can just set the guild.prefix to just ! if it's the default prefix
i have ;; as the default prefix
but still
this shits weird so i just do that to avoid it
Hmm
something like this? js let prefix = guild.prefix; if (authorID == yourID) prefix = guild.prefix || ";;";
Yeah that should work
but then i won't be able to use the guilds prefix
Hmm...
the thing is weird
i edited the code
then prioritize ;;
Hey does any bot dev use glitch? I'm stuck on my verify command and can't fix it
";;" || guild.prefix
Wait you said you have ;; as your default prefix @digital ibex
yes
can someone tell me why discord.js is more Ram and memory consuming than eris?
cache
no lol
yes lol
Cache is frustrating
well
which is why
does eris caches anything?
what does discord.js cache does eris doesnt
@earnest phoenix it does but doesn't have cache method so less ram/memory consuming
i mean like which part does discord.js that eris doesnt
Idk
i am going to fork discord.js so that its less ram consuming
@digital ibex extra functions barely matters, its more to do with the users, members, roles, emojis, guilds, channels and permissions always being cached
how are they accessed from eris when it is not cached?
it is
imma study how caches work in discord.js and eris then fork discord.js because i dont wanna recode my bot to switch to Eris
Idk what the hell was going on, on the discord.js's developers minds when they added cache to the whole thing
this
so everything could be easier?
imagine having to fetch a channel from discord when you wanted to do a command
or a user every time you recieve a message
wot
how does eris fetches channels then?
<client>.createMessage(channeld, content, file)
or, 'channelid'.createMessage(content, file)
(haven't tried that)
string.createMessage
yeah no
Thinking logically
IDs are not special objects created by Eris, they are literally strings
oh yeah
I am using discord.js - v12.1.1
let VC = message.member.voice.channel;
if (!VC) return message.channel.send(` **Join a voice channel and retry!**`);
let perms = VC.permissionsFor(message.bot.user);
I get an error saying user is not defined
but u need to define user
I also use bot not client
message.bot is not a property, nor is it documented, no clue where you got that from
message.member.voice.channel.permissionsFor(message.bot.user);
<client>.user
@heavy marsh
message.bot.user
To
bot.user
- message.bot.user;
+ bot.user
ok hold on i will try that
K
Thank you it workings fine now
Np
How can I bind to an IP using mongodb localhost
you dont have to bind an ip using localhost
@golden condor it can only be accessed from ur pc, thats it so
theres no need to whitelist 1
How's it possible to colorize the result of the eval command?
using code blocks and marking the language
Hmm oh ok
it isn't granted to be colorized it's just syntax highlighting for the language you set it to
Yea ik that
hosting mongodb yourself gives you full control of every aspect of the database
there is no whitelisting system or any other atlas configuration
you have to create those yourself if thats what you want, they dont exist by default
all you need is to make sure the database is accessible via your public IP address
if you want to connect to it from another machine
@quartz kindle I tried that but it keeps timing out at the end of the 30 seconds
then your database is not accessible
Hi , i am using djs v12..
const send = await msg.channel.send(embed) await send.react('✅')
Why this isnt working? I tried everything but not worked.
@quartz kindle is there no way to make it accessible?
you need to configure your router and/or your firewall in order to allow connections
Kk
Any1?
But not work
What is the error?
react of undefined
Send full error pls
full ?
Yes
türk mod varmı
msg.channel.send(embed).then(message => {
message.react('✅')
})
oh, i fixed
That is the same as above but with a callback
yes, but this should also work ```js
let send = await message.channel.send()
await send.react()
@quartz kindle I will try what you said
Incompetence does not mean a language is "stoopid" but okay
2 -3 weeks
It shouldn’t be too long however some can take up to 2-3 weeks yes
oh
Wow
New staff are being added right now so the wait times should be decreased soon
Quick question guys, how do I get hours, minutes, and seconds out of a timestamp?
What kind of timestamp
is there a way to check in discord.js in what category a certain channel is?
What kind of timestamp
@astral canyon message.createdTiestamp
channel.parent@earnest phoenix
Hello guys, I'm trying to do getting message from language.json file with function. But this function shows Promise { 'MESSAGE' }. Can someone help?
if (language !== "en_US" && language !== "tr_TR") return
const file = JSON.parse(fs.readFileSync("./languages/" + language + ".json"));
const text = file[message]
if (!text) return
return text;
};```
client.locale("en_US", "Version")
en_US.json file:
```{
"Version": "1.0.0"
}```
file.message is not working too, because trying to get message from language file
Yes I can
u can but its really stupid to do so
If something works, why would it say error 
cuz it doesnt work
It does LMAO
because there is an error
ERROR IS ERROR
YES BUT IT WORKS
it doesnt spit errors for no reason
and that error is stopping something in that code
No
It didnt stop anything
I dont think the compiler lies or tricks you on April fools
Everything worked perfectly fine
it works but u still doing something wrong
If you did .then()
And it doesn't work... That means you can't use .then() in that function @astral canyon
most likely is the javascript which is causing this issue tbh
Look at the code
like arent u supposed to put a function in then
ok
Hmm
lol
then(() => {})
@earnest phoenix Can help me?
Quick question guys, how do I get hours, minutes, and seconds out of a timestamp?
@knotty steeple he knows but some functions doesn't support .then() method
what language
parse it properly
See, it logs, then says the .then() is not a func, but in the .then() is the log part
@high bough wdym minutes and seconds out of timestamp?
stop saying that
@high bough wdym minutes and seconds out of timestamp?
@earnest phoenix Like 86000 seconds in hours or minuts, etc.
thats not the point
Hmm
.then(() => conole.logo('oof');
^
lmao
My favorite function
🛑
i don't see anything wrong with that
conole.logo
@high bough i still got confused about what you're trying to do lmao
He will fix it if he knows
@high bough <message>.createdTimestamp
Uhh
to find a category in discord.js, do you have to do this? let category = guild.channels.find(c => c.name == 'category name' && c.type == 'category')
category to CATEGORY
Turn like, example 86300000 (which is a day minus 100 seconds) into 23 hours 58 minutes 20 seconds
also that finds the channel not the category
@high bough thats not a timestamp
https://tryitands.ee
@knotty steeple something went wrong so I'm just trying to find what I did wrong
@knotty steeple isn't categories considered as channels?
just use ```js
new Date(message.createdTimestamp).toDateString();
https://discordapp.com/channels/264445053596991498/272764566411149314/701765026549334036
I will fucking die because of this code, pls help pls help 
There's category channels, text channels and voice channels
So technically yes, a category is still a channel
Because if you do
message.guild.channels.cache.size you'll see that it counts the categories as channels so
Big brain
@high bough get a timestamp and divide by 1000
umm, it shows seconds only
kayui, wot r u trying to do? get the bots uptime?
because a message can't be created 12 hours ago
divide for an hour and whatever
like the 1 u r trying to get
what
from what he said, it sounds like he's trying to get the time the message was created at
or she
<Message>.createdAt()
Hmmm
Use timestamp
Im trying to use modulo divisions r niw
How can i create a command to delete my bots messages in eris?
from what he said, it sounds like he's trying to get the time the message was created at
Can anyone help me with an issue I have, for all of my bots the token changes every few seconds
It only started doing it today
Your bot is most likely logging in >1000 times
in a day
This can happen if your bot keeps restarting
It’s not to do with the code tho
No
Also when I try boot up my bot it says invalid token
And on the site it keeps changing
The only thing (hopefully) using your token is your application, so showing the code might help us investigate why that might happen
Can I not use brodcast eval to get the total amount of vc's the bot is connected to? - v12.1.1
const promises = [
bot.shard.fetchClientValues('guilds.cache.size'),
bot.shard.broadcastEval('this.guilds.cache.reduce((prev, guild) => prev + guild.voiceConnections, 0)'),
];
Promise.all(promises)
.then(results => {
const totalvcs = results[2].reduce((prev, voiceConnections) => prev + voiceConnections, 0);
Whenever I refresh the page
you sure its not someone else?
How could it be
Regenerate the token and try it with the new one
the token changing everytime you refresh the page simply cannot happen
it's probably something on your end, but if you're clueless you can try contacting discord support
and you're exactly using the token you get from here?
2FA*
I gtg
I will be back later
But yes
It’s from there
It changed every time I refresh the page
kk, i'd say check your code for now, maybe you're accidentally logging in multiple times
what page? the bot page?
yeah when you press regenerate
no no
sometimes u dont even have to press regen
happened to me million times
giving me different tokens without regen
never had that issue once
Are you using glitch or something for hosting
i have the feeling that they think that the bot works through the bot page idk
we had multiple people who thought that putting code into the bot description will host it
lmfao
Also can some one help me on sharding issue - https://discordapp.com/channels/264445053596991498/272764566411149314/701775132678684773
@earnest phoenix what do u mean put it in the description
I put it in the code
But it is always invalid
Bc it keeps changing
good good, we just had multiple people putting it into their bot description because they had 0 idea how it works
again, showing us the code (with censoring the token ofc) might help us
@heavy marsh results[1] not [2]
I have something set for 1
const promises = [
bot.shard.fetchClientValues('guilds.cache.size'),
bot.shard.broadcastEval('this.guilds.cache.reduce((prev, guild) => prev + guild.memberCount, 0)'),
bot.shard.broadcastEval('this.guilds.cache.reduce((prev, guild) => prev + guild.voiceConnections, 0)'),
];
Nope I did past is full sorry
I connected it to one of my vsc
but it still shows 0
No errors
const promises = [
bot.shard.fetchClientValues('guilds.cache.size'),
bot.shard.broadcastEval('this.guilds.cache.reduce((prev, guild) => prev + guild.memberCount, 0)'),
bot.shard.broadcastEval('this.guilds.cache.reduce((prev, guild) => prev + guild.voiceStates, 0)'),
];```
like this?
voiceStates.cache.size
Hey, I use discord.js. Does anyone know how to check if the bot has a permission? A little bit like msg.member.hasPermission but with msg.member as the client. I have already tried Discord.Guild.me.hasPermission but it doesn't work.
https://cdn.danbot.xyz/tB06Lp84
const promises = [
bot.shard.fetchClientValues('guilds.cache.size'),
bot.shard.broadcastEval('this.guilds.cache.reduce((prev, guild) => prev + guild.memberCount, 0)'),
bot.shard.broadcastEval('this.guilds.cache.reduce((prev, guild) => prev + guild.voiceStates, 0)'),
];
Promise.all(promises)
.then(results => {
const totalGuilds = results[0].reduce((prev, guildCount) => prev + guildCount, 0);
const totalMembers = results[1].reduce((prev, memberCount) => prev + memberCount, 0);
const totalvcs = results[2].reduce((prev, voiceStates) => prev + voiceStates, 0);
@spice smelt ```js
message.guild.me.hasPermission();
@earnest phoenix at the top i have const token = 'The token'; then at the bottom i have bot.login(token);
@digital ibex ok. i'll retry.. thank you
👍
@earnest phoenix it used to always work
Try to regenerate the token by yourself then
@heavy marsh i told you, guild.voiceStates.cache.size
Even when I don’t, the token is apparently invalid
lemme just do something dangerous, sec
If I do that it shows 4
Which is wrong
const promises = [
bot.shard.fetchClientValues('guilds.cache.size'),
bot.shard.broadcastEval('this.guilds.cache.reduce((prev, guild) => prev + guild.memberCount, 0)'),
bot.shard.broadcastEval('this.guilds.cache.reduce((prev, guild) => prev + guild.voiceStates.cache.size, 0)'),
];
@sacred mountain and your Token has this format? (regenerated the token ofc)
You just generate an additional token
How
Your old ones are still valid
do you mean me rn or him
The only way to make all previous tokens invalid is by regenerating your token
oh him nvm lol

They all say invalid
It’s odd
But why do they keep changing
They don’t normally
whats the npm package that allows for bots to stream youtube videos
i still think its something on the code, but otherwise im really clueless
Your IP may have been banned from the API
and how could that happen? by hitting the ratelimit multiple times or?
aye guys, sorry for disturbing but i gotta question .. is it possible to add a bot without a prefix ?
tokens are made of two parts: a timestamp and a code. when you refresh the page, the timestamp part of the token gets updated, causing it to change, but the actual token code doesnt change
I finally got this right!
var seconds = Math.floor(((res.dailyclaim + 86400000 - message.createdTimestamp) / 1000) % 60)
var minutes = Math.floor(((res.dailyclaim + 86400000 - message.createdTimestamp) / 60000) % 60)
var hours = Math.floor((res.dailyclaim + 86400000 - message.createdTimestamp) / 3600000)
so its normal for the token to change when you refresh the page
the code part of the token, which is the important part, only changes if you regen your token
aye guys, sorry for disturbing but i gotta question .. is it possible to add a bot without a prefix ?
@sleek bear Ofc not.
@high bough gonna be honest, that's borderline unreadable
aight, then it wont be able to just delete the msg of a specific "person" after a timer ?
Sry
aye guys, sorry for disturbing but i gotta question .. is it possible to add a bot without a prefix ?
@sleek bear https://discordapp.com/channels/264445053596991498/325648177178869760/699373125195792405
tbh thats a mute case, not a decline case
Oh lol, i thot
@quartz kindle the tokens don’t work
They all say the same thing when I try to run it
@sacred mountain regen it, then DM me it, let me test here
@sacred mountain I'm pretty sure I see you in almost all the help channels on every single server.
Yup
Did you define the token twice? @sacred mountain
.?
i smell glitch project
it is
I Use GCP
nvm it isnt a glitch project
@sacred mountain little off topic question but how old are you
Seems 15 to me
We have a special program for ppl under 13
to get them into development
and help them more
what package do bots use to stream youtube music
Called ban
lmao
Lmao
Why does everyone think I’m 9
fr tho how old are you
You sound like it
Asks every single error you get, doesn't even spend time to search google
On every server lmao
Well ppl are helpful here
Prob wrong url on using POST method
how can i fix it?
Check your URL that you're using the POST API on, make sure it's correct.
Otherwise its probably the code that you post
im not using any url
API?
doesn't say
it anywhere
nope
it said it has smthing to do with fields
not an api lol
are you sending an image link through embeds
this is the code i added when i got the error ```js
fields: [
{
name: 'Old Message',
value: { content: message.content },
inline: true
},
{
name: 'New Message',
value: message.content,
inline: true
}
]
no
Tf, i cant read on my phone
I'll pass for now, bye guys.
I don't use eris either, so imma bit confused tbh
i am trying to get the message before it was edited
is this a messageUpdate event?
yeah
yes
Eris, a NodeJS Discord library
you need to check if oldMessage exists before using it
since it might be null if not cached
oh, ok
i am having another trouble with audit logs
i can't find a way to get the member who done the action
like
if i delete a message, how can i find out who deleted it?
all i know is that i have to get the audit log and filter it by action
but
¯_(ツ)_/¯
Eris, a NodeJS Discord library
@copper cradle remember me ?
client.emojis is a thing
cant i use something like
client.emojis.get(ID)
And then just reference the variable you stored it in wherever.
so I can do
const emoji = client.emojis.get('2145912849128498214')
and then
message.reply(emoji.id);
var emoji = client.emojis.get(ID)
message.channel.send(emoji)```
is an example/
My id is always stored as a variable since I define that somewhere else too but yeah
if you're using discord.js v12, its client.emojis.cache.get()
yup
I still haven't migrated to v12 😂 and I never will
ok so why the fuck am i getting 404 on this
ok nvm that was stupid as shit
if channel is a number it shits itself
string works
of course it does
oof
it is literally the same string
using string
using number
oh wait a minute what
its not the same string

@quartz kindle ur js pro can u tell me whats going on
.then(() => {})
where do you want to use .then?
@mossy vine its not the same string
one ends in 40, the other ends in 42
because IDs are too large for numbers
you can use
...send().then(newMessage => { newMessage.react() })
or you can
newMessage = await ....send()
newMessage.react()
Depends on whether you want to react to the message you sent or the one you received
the message that the bot replies to
then its correct
Then it should work
do you need them in order?
if order doesnt matter, you can do js message.react() message.react()
error
if order matters, then you need ```js
await message.react()
await message.react()
or
message.react().then(() => message.react())```
emoji must be a string or guildemoji/reactionemoji
its 
is it a custom emoji?
try .react("315009125694177281")
yes but try it directly like that
doesnt work
error?
your bot is not in the server where the emoji comes from
or your bot doesnt have "use external emoji" permission
is it okay to even ask basic question here about coding for a discord bot? cause no matter what i looked up online it doesn't solve my issue. i am new to Javascript but not new to programming
@quartz kindle it works but how would I make it to react to the message the bot sent
use .then or await (and store into var)
you said you wanted to react to the message the bot replies to, not the message the bot sends
otherwise do like i said before
@restive furnace i wasn't sure, so i just asked in general before. My issue is, i want to be able to Add a Role to a person who joined the Server, they will receive a message and upon typing in a command the role is to be added. but i get a error every time i try it.
TypeError: Cannot read property 'roles' of undefined
at DiscordClient.<anonymous> (D:\Discord Bot\DiscordBot\bot.js:46:32)
at DiscordClient.emit (events.js:315:20)
at DiscordClient.handleWSMessage (D:\Discord Bot\DiscordBot\node_modules\discord.io\lib\index.js:1854:11)
at WebSocket.emit (events.js:315:20)
at Receiver.ontext (D:\Discord Bot\DiscordBot\node_modules\ws\lib\WebSocket.js:841:10)
at D:\Discord Bot\DiscordBot\node_modules\ws\lib\Receiver.js:536:18
at Receiver.applyExtensions (D:\Discord Bot\DiscordBot\node_modules\ws\lib\Receiver.js:371:5)
at D:\Discord Bot\DiscordBot\node_modules\ws\lib\Receiver.js:508:14
at Receiver.flush (D:\Discord Bot\DiscordBot\node_modules\ws\lib\Receiver.js:347:3)
at Receiver.finish (D:\Discord Bot\DiscordBot\node_modules\ws\lib\Receiver.js:541:12)
codetoo
cache
@surreal wind you're using a very old and outdated discord library
message.guild.cache.roles.get
please remove discord.io
use discord.js or eris. instead
Okay how do i do that?
and look into http://discord.js.org/ or https://abal.moe/Eris/
hi, i'm having trouble trying to get the members old nickname with eris
I jsut folled a guide to set up a bot
you followed a very bad guide
which hasnt been updated in over 5 years
well i couldnt know^^
i'm having trouble here:
debug
try log it console.log({oldMember})
how can i get the oldMember? like, do i define it as a variable of the guildMemberUpdate d or smthing
?
im just having trouble accessing it
<client>.on("guildMemberUpdate", (guild, member, oldMember) => {});
^
simply oldMember.nick?
<client>.on("guildMemberUpdate", (guild, member, oldMember) => {
console.log(oldMember.nick);
});
how much ram is a bot supposed to use because i think something isnt right
message.channel.send(embed).then(function (message) {
message.react('486453662923751424')
message.react('486453681940594699')
depends on library and how many guilds/users you have
missing )
thank you
discordjs and 65 servers
after argument list
discord.js can use several hundreds of MB of ram
Discord.JS after it has been ran for while, the ram usage may become high.
cause cache things..
makes sense then lol
with 65 servers, a normal usage should be around 150-200mb
lmao I kind of want to make a bot like the taco one, but I have no idea how to start with that. I do have experience with discord.js and javascript in general tho
btw guys, i just wanted to ask, is it just me or are making ur own audit log kinda thing hard?
thats normal
it is hard or?
audit log would just be sending stuff to a channel
yeh
so if you can figure out the channel it's just sending an embed after the bot does the command to the channel
Depends on what you want to log
@royal portal if its missing ) then fix it lol
no because i am trying to get the member who deleted the messag e
I'm sending an embed not a message
and its a pain
Okay I'm lost on how to get rid of the old and get the new stuff. just delete the folders and then install everythign anew?
also remake or edit your package.json
i'm trying to access it
follow this guide: https://discordjs.guide, and select v12.
like
its not <guild>.auditLogEntry
and i can't find it how bc eris' search bar doesn't work
anyone know how to make it so the bot reacts to the embed it sent?
oh?
the result is an object containing instances of auditLogEntry
@royal portal the code you showed before was correct
and to get the author member object, you need to get executor id, and then fetch/get the member from the guild with the id.
it didnt work
error?



