#development
1 messages · Page 878 of 1
np
@fallow quiver are you using Discord.js v12.
Should Be The Latest, How Do I get the ver
You need to pass an object: https://discord.js.org/#/docs/main/stable/class/Message?scrollTo=delete
You get the version by checking your package.json
I found that the error had to do with the delay argument in message.delete()
But It was working a few days ago
is message.delete(2000) the wrong way to pass the augument?
@topaz sphinx better to format with sql-type codeblock
SELECT %I_refresh
FROM users.ratelimits
WHERE user_id = $2
anyway, that query is wrong
you can't SELECT * FROM users.ratelimits
it'd be
SELECT ratelimits
FROM `users`
WHERE user_id = $2
I'm considering that ratelimits is a column present in "users" table, and you need to filter based on user_id
right?
Is this the proper way in node.js to make an embed?
` const exampleEmbed = new Discord.MessageEmbed()
.setTitle('Some title')
.setDescription('Description after the edit');
message.edit(embed); `
have you tried?
I'm trying to help my friend
So
I mean I can't really test anything out myself
why message.edit() and not message.send()
why not just go on and run it on vscode or whatever
tell him to...
https://tryitands.ee
let amiibo
const send = amiibo.name
// after some if statements...
amiibo = {name: "hi"}
ctx.send(send) // would amiibo be redefined to the object or would i have to put send after it got redefined?
the fuck do you mean
will amiibo send as undefined or hi
isnt let a constant in js?
dep what the fuck
let variable
variable: undefined
oh so were just making different names for the same thing now
because were ecmascript
@trim saddle im pretty sure primitives will be copied once you assign them to a variable in js
Ping me when you guys have a correct response, lol idk who to listen to rn
@earnest phoenix the guy who told you to try and see
dep idk what a primitive is but look at my screenshot
you know what
how do you create an embed where when you type in *help it replies with an embed
if i set amiibo via function
anything that can be allocated in the stack is a primitive
then that would make it a lot easier
uh
consts are primitive
idk
@queen violet they're different, let doesn't get hoisted at runtime, while var does
so doing this works
how do you create an embed where when you type in *help it replies with an embed
console.log(x); //undefined
var x = 4;
But this doesn't
console.log(x); //ReferenceError: x is not defined
let x = 4;
blame es
how do you create an embed where when you type in *help it replies with an embed
what happens with var is the following
@queen violet var is hoisted

var and function definitions get hoisted to the top of the file when executing basically
but
why
//the code you write
console.log(x);
var x = 4;
//what node does
var x;
console.log(x);
x = 4;
that's why it doesn't error
and that's why they added let
var should be removed or remade
the problem is
a lot of old code would break
Hello
why my commands with spaces cant work but single without spaces work fine
const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
it correct ?
whatever code uses this hoisting deserves to break
yeah lol
i'm trying to create and embed where I say *help and it replies with and embed so what do I do to change this
const exampleEmbed = new Discord.MessageEmbed()
.setTitle('Some title')
.setDescription('Description after the edit');
message.edit(embed);
what do i do here so when i type *help it replies with an embed
@white glade your command name is being split over the two arguments cause it has a space
ha imagine not using raw embeds
uh
what is a raw embed
using raw JSON data
#development is strictly discord.js im coming to realize
{ embed: { title: "this" } }
you're not using js codeblocks
you are our shine heroes guys 🙂
my statically typed ass prefers the non json option tbh
https://leovoel.github.io/embed-visualizer/ looks like this
does anyone have a map of shortcodes (:joy :) to unicode
you can try things and look online instead of expecting to be spoonfeed
you didnt even describe what your problem is
i've been looking though
@queen violet looking for something like https://github.com/muan/unicode-emoji-json ?
Emoji data from unicode.org as easily consumable JSON files. - muan/unicode-emoji-json
hey i find solution for my 'arguments with space' problem
but it looks its work only for one command
its posible to make work it global in my commands folder?
If you put it at the start of your message event then pass it to all your commands that should work
your command handler should be global by default?
Would you guys say its worth switching to Eris to keep RAM usage down? I know it has full API coverage like Djs (which I use atm) and I don't want to upgrade my VPS yet
I only have like 50k users and ram usage is 60% but I've been gaining users/servers pretty quickly since everyone is home
Just wondered what people think
I had more users than that and didn't even use a gig
ah
I looked through the docs and it doesn't look too much more complicated (my bot is my first ever experience of javascript so I'm new to it)
But I'm not sure if it's worth the switch
You'll need to do a lot of recoding
you can try out tim's lib which gives d.js a good decrease in memory usage
Oh is that publicly available?
Oh thanks
you'll have to see if it's for you though
@lyric mountain someone actually responded to the query issue earlier with quite a large response
i needed that reference
so their solution went by this
EXECUTE format('SELECT %I, %I_refresh
FROM users.ratelimits
WHERE user_id = $1',
_name, _name)
USING __user_id
INTO ratelimit, reset_timeout;
which is quite clean
How can i access a local host db on my server on my host pc (different networks) - Using mongodb
@mossy vine i am in needum of more helpum
let choice = await ctx.awaitMessages(msg => availible.includes(msg.content), { time: 10000, maxMatches: 1 }) // []
let thing = choice.length === 1 ? parseInt(choice[0])-1 : undefined
if (thing) {
em = setEm(amiibo[choice]) // embed
m.delete() // message
ctx.send(em)
}
else return ctx.send("Looks like you didn't respond in time.") // even there is a response from choice, i always end up here
so you made an own api for your bot-
no, i just made a class for it
alright uuh
you could try if (thing != undefined)
it's just a variable
try
choice.first()
as it returns a collection I believe
not an array
i think his if statement isnt being run at all
it's a Collection<Snowflake, Message>
// even there is a response from choice, i always end up here
well choice.length is undefined
as it extends map
I think it's size
choice.size
this is why i hate untyped languages
you can make yours work if you do choice = Array.from(choice.values())
if you really want to use an array over the collection
choice is an array of objects
this isn't d.js
something from eris-additions
sowwy
python is the only language to use the variable name ctx
@west raptor nope you can call a variable whatever you want, generally SSL code in C or C++ will use a var called CTX
I believe it was sarcasm
also canvas uses ctx
It's short for context usuly so it fits anywhere in any context... Pun intended.
Yup
@green kestrel i have an iq higher than 1
You can have an IQ of 200 and make that assumption, saying something is specific to python doesn't make you dumb
It doesn't? Really? 😂
you continue to prove my point
Nah just need a sarcasm upgrade to British level
did y'all forget about my problem
if you want to ensure a number is passed you should add !isNaN(msg.content) to your filter as well (yes it works with strings https://oliy.is-just-a.dev/9af60g_3606.png )
Hmm
but I don't believe that's your issue either
You can use Number("somestring") too
it returns nan if the string cant be converted to an int
There's another trick I like to use, it might not be good for you: let guaranteed_numeric = anyvar + 0.0;
what is the issue even?
It's easier to use true/false as their already booleans
@amber fractal what if i sent the rest of the code
if you want to
if (amiibo.length > 1) {
let availible = [], options = []
amiibo.forEach((v, i) => {
options.push(`\`${i+1}.\` ${v.amiiboSeries}`)
availible.push(String(i+1))
})
ctx.send(`Looks like there's multiple entries for this amiibo, please choose one.\n\n${options.join('\n')}`)
.then(async m => {
let choice = await ctx.awaitMessages(msg => availible.includes(msg.content), { time: 10000, maxMatches: 1 })
let thing = choice.size ? parseInt(choice[0])-1 : undefined
console.log(thing)
if (thing != undefined) {
console.log(amiibo[choice])
em = setEm(amiibo[choice])
m.delete()
ctx.send(em)
}
else return ctx.send("Looks like you didn't respond in time.")
})
@green kestrel that only works with - * / in js, not with + lmao
if (!Number("1")) {console.log("A")} else {console.log("B")} // b
Yes, but that uses more memory because it has to be converted to a boolean
alr
Yeah I said might, it'll concatenate your strings 😁
Like if you worry about small bytes of memory bruh
any good programmer does
that memory adds up over time

._.
@trim saddle it's an array of messages right?
if a message is returned in time yes
shouldn't it be choice[0].content then?
when parsing
also you had it right
I thought you were on d.js
choice.length was right
hi, when i am trying to connect to mongoose, why do i get this error?
does anyone know?
is your mongo server running?
you need to have a mongo server running
windows
then it's easy
well it's easy regardless lol
I said don't worry about it
@trim saddle did it get working?
run the msi, you might need to restart after you run it I don't think so tho
msi?
it's the microsoft installer
AYYY!
the thing you just downloaded
oh
mongo.msi whatever it was
thanks steve from minecraft!
ye
If you want to use it from a separate pc you'd need to open your firewall, but because it's local you won't need to, just considerations for the future.
How do you send a custom emoji in the title of an ember (after the message) so for example: Title👀 How would I add the 👀
Custom emoji or default emoji like 😄
i think the variable for that is client.emojis.find(f => f.id=="id of emoji").first()
Im not sure so if that doesnt work @ me
Ok
Wait where would I put that @earnest phoenix
I can show you the code to make it clearer
in the embed title
.setTitle(Some text and then ${client.emojis.find(f => f.id=="id of emoji").first()})
Im not using that kind of embed tho?
wat
case "loot":
message.channel.send({embed: {
color: 3447003,
title: "Shatters Loot Tracker",
fields: [
{ name: "The Forgotten Sentinel Whites", value: SenitelWhites},
{ name: "Twilight Archmage Whites", value: ArchmageWhites},
{ name: "The Forgotten King Whites", value: ForgottenWhites},
{ name: "Total White Bags", value: Totalwhitebags},
]
}
});
break;
Dont know why it got so screwed when I wrote it here
hey i used lavalink for my music bot and im trying to play music, now on my pc its working, but on my vps its not and its giving me back this error:
0|npm | Caused by: java.lang.RuntimeException: java.io.IOException: Invalid status code for video page response: 429
0|npm | at com.sedmelluq.discord.lavaplayer.source.youtube.DefaultYoutubeTrackDetailsLoader.loadDetails(DefaultYoutubeTrackDetailsLoader.java:28) ~[lavaplayer-1.3.38.jar!/:na]
0|npm | at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack.loadBestFormatWithUrl(YoutubeAudioTrack.java:75) ~[lavaplayer-1.3.38.jar!/:na]
0|npm | at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack.process(YoutubeAudioTrack.java:42) ~[lavaplayer-1.3.38.jar!/:na]
0|npm | at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.execute(LocalAudioTrackExecutor.java:91) ~[lavaplayer-1.3.38.jar!/:na]
0|npm | ... 4 common frames omitted
0|npm | Caused by: java.io.IOException: Invalid status code for video page response: 429
0|npm | at com.sedmelluq.discord.lavaplayer.source.youtube.DefaultYoutubeTrackDetailsLoader.load(DefaultYoutubeTrackDetailsLoader.java:39) ~[lavaplayer-1.3.38.jar!/:na]
0|npm | at com.sedmelluq.discord.lavaplayer.source.youtube.DefaultYoutubeTrackDetailsLoader.loadDetails(DefaultYoutubeTrackDetailsLoader.java:26) ~[lavaplayer-1.3.38.jar!/:na]
you are being rate limited
replace your title: "Shatters Loot Tracker", line with ```js
title: Some text and then ${client.emojis.find(f => f.id=="id of emoji").first()},
and its still like that
Like I want to add the emoji before name: "The Forgotten King Whites (emoji here)"
Ok
Ill try that
that will place the emoji in the title of the embed
if you want it somewhere else, just change the " quotes to ` and place ```js
${client.emojis.find(f => f.id=="id of emoji")}
doesn't find return 1 result
not a collection
so you won't have to use first()
i
am
stupid
sorry
its late at night and my brain is literal doodoo
remove the .first() at the end
soo..
then it should work
{ name: ("The Forgotten King Whites", ${client.emojis.find(f => f.id=="id of emoji")}), value: ForgottenWhites},
Something like that?
IDK
Where do I put it then
Like where in this
{ name: "The Forgotten King Whites", value: ForgottenWhites},
Do I put it
{ name: `The Forgotten King Whites ${client.emojis.find(f => f.id=="id of emoji")}`, value: ForgottenWhites},
Ahhhh
Ill try that
Got an error "client is not defined"
Nvm im stupid
Forgot the id
Dont laugh at me!
wait
or you could just use .get
or hard code it
@buoyant totem what did you define your discord client to
<:eaa:34234432>
bruh
SHHHH
new error however
"bot.emojis.find is not a function"
@earnest phoenix
Also I wanna point something out
what version of discord.js are you using
I know exactly where your profile pic is from lmao
It's when he says "That is a fcking alarm clock"
Right?
Lmao
I love him ahaha
Where do I check my version? Still quite new to discord.js
found it I think
^12.2.0
If you're on Discord.js v12, it'd be .cache.find
If you have the ID, it's better you use .get
emoji cache isnt complete, so resolve is safer
client.emojis.resolve("id")
Ok ill try that
What do you mean it's not complete?
@sudden geyser discord.js doesnt cache all emojis
so if the emoji you want isnt in the cache, .cache.get doesnt work
@amber fractal so there's a new issue noe
ok
.resolve however fetches the emoji and no cache is required
resolve just checks the cache for its ID or instance.
which is?
wait lemme search something
In the source code: https://github.com/discordjs/discord.js/blob/stable/src/managers/GuildEmojiManager.js#L90
In the source code of BaseManager: https://github.com/discordjs/discord.js/blob/d827544fbd12e827fb4b6ff99d8894ecd79ede02/src/managers/BaseManager.js#L59
How does one get a "Bot Developer" role 
By submitting a bot and getting it approved.
@amber fractal oi come back
that would make sense
But Im in game
and yes, my bad @earnest phoenix
np
oh i gues i cam wait
sorz
@trim saddle hi
hi
what u need
o I know
0 in js evaluates to fallse because js is dumb
1 - 1 = 0 so
you'll need to 0 check too
add || choice == 0
oh ok
js big dumb on that
mb
use triple equals
because false == 0 is true but false === 0 is false
double equals worked
oh ok
How would I make the bot react to an embed with a custom emoji? I've gotten it to react but to my message and not its own embed
@earnest phoenix
an embed is part of a message
after sending a message contaning the embed, await the result. it should be a message object which you can react to
what lib are you using
Nonono thats not my problem
What cyber said
then what is
My problem is that the bot is reacting to my message
I dont know how to get it to react to the embed it just sent
@buoyant totem you have to await the message
I can send the code if you want
yeah, await the message you are sending and react to that one
How would I do that?
12.2.0
oh
^12.2.0
Gimme a sec
message.channel.send(msg).then(m => m.react())```
this is if the function itself is not asnychronous
uh....
m.react() takes an emoji as parameter, so the client.emojis.resolve still applies
i think
Now im even more confused
i literally gave u the cose 😩
basicially, you promise a message.channel.send
Idk
you dont promise shit, the function returns a promise
Boi im new to node and discord.js
well
Im trying to.. 😭
browse d.js docs
Basicially, ```js
(send your message).then(sentmsg => {sentmsg.react(emoji)})
await m.react('')```
specifically the part about message sending
he doesnt use async rn
uh
@vestal crystal 0 need to await react
embed = message
Ah
an embed is part of a message
when you are sending an embed, under the hood d.js is sending a message without text and with an embed
@vestal crystal there was no code to begin with lmaoo
i meant the code you and i gave him
And if its a custom emoji?
which one is adviceable when restarting a bot with a command..
client destroy and call login or exec pm2 restart?
client.destroy and then login
<:emoojiname:id>
@buoyant totem you said you already got that working just do it the same way
ty
But that was a message in the embed
Jesus
ok you are making zero sense
for reference that is the number of brain cells i will have left after this conversation
Stop bullying me 😭
@mossy vine lol
@buoyant totem message.react takes a emoji as parameter, so just message.react(client.emojis.resolve("id"))
doesnt d.js resolve it anyways
WHY NOT
i think it does
then no need for that
m.react('<:emojiname:emojiid>')
because that would not work

@earnest phoenix it does for me
wait what
im on v11.6.4 tho
Still reacts to my message..
Sure
only the relevant parts of the code tho
^
switch (args[0]) {
case "fk":
message.channel.send({embed: {
color: 3447003,
title: "The Forgotten King Loot",
fields: [
{value: "React with the bag you want to see what loot you've gotten from that bag!"},
]
}
}).then(message.react(bot.emojis.resolve("701160044892258376")));
break;
break;
🤦🏽♂️
.then(m => m.react())
m => m.react
what does m stand for?
that way you are reacting to the promised message, not the original
just message
message
its just a variable
ah ok
you can call it whateevr
if you want to call it thisIsACoolVariable you can but then call thisIsACoolVariable.react()
Works
thats for args tho???
Ty 😄
:))
lol
You arent, we understand you are new
Ty lads
i suggest you learn a bit about promises and arrow functions so you can understand what you just did a bit better
Ok
yeah
^
nasa.hack()
you could join the djs support server
Ah
lmao no dont
nasa.client.destroy()
@buoyant totem btw for async await and promises: https://javascript.info/async-await and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise are your friends
ok #memes-and-media xd
yeag
life.destroy()
Error: Life is null
yeah?
How would I do it if I want multiple reacts in a specific order?
await each
^
So just repeat it?
yes
not exactly
if you use async and awaut fhen yes
then yes, but with .then chaining its a bit different
I thought this would be an easy question but now i'm more confused than when my sister found out she's adopted..
since .react returns a MessageReaction, not a message, you still need to be reacting to the message you sent earlier, instead of redifining it

but its definitely easier with an async function
I just waited 10 hours
@raven crystal wait are you waiting for it to be approved?

did you code your bot? is it online and working?
Yea takes 2-3 weeks
Yes cyber
did you run the code
okay yeah, then wait 2-3 weeks
Hey cyber
So like this?
?
.then(m => m.react((bot.emojis.resolve("701171352555749498"))(bot.emojis.resolve("701160044892258376"))));

k im pretty sure its gonna be declined but im not sure about the rules of using that app
i had faith
^
I feel heavily bullied rn
@buoyant totem no no no no no that is completely wrong
You dont say..
Brb 2-3 week

Ill stay in bedrock
@buoyant totem we are not bullying you at all
@raven crystal If you don’t need development help, dont type in this channel. Feel free to talk in #memes-and-media
bruh
My pc saw it and just went "Hell no I aint taking this shit. Im going to bahamas or something"
@raven crystal bots made from bot makers are going to be denied just sayin
@earnest phoenix false
not always
well unmodified ones
Yea
iirc there is a certain rule that allows dbd
^
but im not sure
How would I do it then cyber
i only know bot ghost is allowed if it contains custom commands
How can I wait for the link to be created before moving on?
link?
var link = `https: // discord.gg /`;
var invite = channel.createInvite ()
.then (invite => {link + = invite.code;})
.catch (Console.Error);
What link?
In this code, sorry
Uhh
Console 
well uh there is the .then right there so..
user await instead of using .then()
*Uh
@amber fractal doesnt it not matter tho
wym
Are you talking to me?
link + = invite.code;
console.log(link)
say you have what they have
var link = `https: // discord.gg /`;
var invite = channel.createInvite()
.then (invite => {link + = invite.code;})
.catch (Console.Error);
console.log("x")
x will log before link is added to
@tired cloud Ok, but I need the link to use in an embed
wait x seconds asynchronously?
using .then() allows code to continue to be executed
@mossy vine How would I write it if it had several of them in a specific order?
using
.then()allows code to continue to be executed
@amber fractal Yes
@buoyant totem im actually not sure if you can without using async/await
You can't that's the whole point of Promises
How do I do that then..
using async/await
yes
.then (invite => {
link + = invite.code;
message.channel.send(new Discord.RichEmbed().setDescription(link))
})
@amber fractal I can't use await
using .then() allows code to continue to be executed
@amber fractal Yes
@balmy knoll correction,.then()allows code to be executed after the promise has be completed
.then is literally for async/await without await
I'm not using an async function
let me make the example
@mossy vine Im looking through the docs @earnest phoenix sent and I have a headache now.. Wtf does that even mean
I mean
Yes you are 😦
@tired cloud I can't send the message in then since I have to do many more checks before sending the message
bruh
😉
you need to know a bit js before you understand these
Ik.. I wanted to get into this since I mostly know c#
And I thought this was a good way to get started
And tbh its fun
But some things are just so confusing and my tiny adhd brain doesnt have the patience to read through a long docs page
Tbh, may i ask how old you are
17
@amber fractal Do you have any solution without using await?
alr
then use await
Bruh
May I ask why?
@balmy knoll using .then
@buoyant totem its like this: any person under 13 is not allowed to exist on discord
ths!ping
Smh
oh woops
Answer is easy, await or then
Anyways
¯_(ツ)_/¯
How would I do it if its not the way I tried? @earnest phoenix
Alrighty
experiment with stuff like modules, how you use them
and eventually pick up on promises
https://oliy.is-just-a.dev/wtz4iv_3607.png https://oliy.is-just-a.dev/rtyfwi_3608.png
await pauses code execution (evident in the After await (time: 2ms) time is 2ms and it was logged after lol) whereas .then() allows the process to continue running the next line (evident in the fact that lol was logged after the time in the .then() example)
your solution would be to put all the code you want ran after in your .then() or use await
@amber fractal Ok, but that code is not inside an async function
your solution would be to put all the code you want ran after in your
.then ()or use await
I try now
if you dont make it wait for an answer (await or then) how do you expect to get the code?
@amber fractal Thanks. Resolved
👍
localhost is like the best hosting service in the entire internet
0ms delay.. wow
?
How do they do that??2
i use localhost on all of my projects, its so fast 
It really is
you create a db
before, i just had to send a message and refresh compass
and it'll automatically create one
but for some reason its not working this way
with localhost, what do i do to set up my bot?
is your bot in the same computer as mongodb?
getting a issue when I try to start my bot project
you press ctrl + c
which you are not supposed to do
also you use npm init
which makes a package.json and doesnt start the bot
also you can clearly read what you are supposed to do at this point
@still merlin you need to do
node . to start your project
when I said to start my bot I mean begin my coding with it
And ctrl + c to close the process
Oh
npm init makes your package.json
you arent supposed to do ctrl + c
just let it run
nothing
ok thanks
and why
And to store your code into a file look what you named the entry point in the package.json and name the main code file that
I've got a odd error
ok thanks
I'm so stupid oof
what lib
check if channel.type is "dm"
if(channel.type === dm) ?
"dm"
How does awaitreactions work? whenever I react nothing happens and I dont get any errors
Been trying to do it now for over an hour..
This is how it looks atm
switch (args[0]) {
case "fk":
message.channel.send({embed: {
color: 3447003,
title: "The Forgotten King Loot",
fields: [
{value: "React with the bag you want to see what loot you've gotten from that bag!"},
]
}
}).then(m => {
m.react('701171382381314128')
m.react('701171341717405717')
m.react('701171352555749498')
m.react('701171373032079390')
m.react('701171390010622012')
m.react('701160044892258376')
});
message.awaitReactions((reaction, user) => user.id == message.author.id && (reaction.emoji.name == '701171382381314128' || reaction.emoji.name == '701171341717405717'
|| reaction.emoji.name == '701171352555749498'),
{max: 1, time: 30000}).then(collected => {
if (collected.first().emoji.name == '701171382381314128') {
message.reply('Ok');
}
})
break;
break;
But the bot doesnt reply with anything. I tested with just one of the emotes with no success what so ever
i guess the name isnt its id
jfhgdkjfjklaj
you say
if the emoji's name is 701171382381314128, reply with Ok
mhm..
it should be
if the emoji's ID is 701171382381314128, reply with Ok
so replace emoji.name with emoji.id
did u restart ur bot
Yup
Always
I also replaced the other emoji.name with emoji.id
Just got a massive error..
"Cannot read property 'emoji' of undefined"
wait what
how can i check if a users id is in a db table?
wait did you replace the other reaction.emoji.name with .id too?
Si
hm
hmm indeed
I just wanna be done with this so I can go to bed lmao. I actually have a headache now :/
😦
wait
Does this tell you anything
@earnest phoenix
"Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was
not handled with .catch()."
It's part of the error
you managed to show everything but the actual error
Was that the error?
no
oh
This is all of it
w h a t
"(node:16144) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'emoji' of undefined
at D:\Aa Loot Tracker Bot\index.js:63:35
(node:16144) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was
not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:16144) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code."
idk
Alright
Ill get an aspirin and ill brb
wait
Does awaitreactions need to be in an async?
@earnest phoenix
dont think so
no
@buoyant totem show your code
you're trying to get emoji property from something undefined
Ok 1 sec
I assume the collection ended with no items collected.
switch (args[0]) {
case "fk":
message.channel.send({embed: {
color: 3447003,
title: "The Forgotten King Loot",
fields: [
{value: "React with the bag you want to see what loot you've gotten from that bag!"},
]
}
}).then(m => {
m.react('701171382381314128')
m.react('701171341717405717')
m.react('701171352555749498')
m.react('701171373032079390')
m.react('701171390010622012')
m.react('701160044892258376')
});
message.awaitReactions((reaction, user) => user.id == message.author.id && (reaction.emoji.id == '701171382381314128' || reaction.emoji.id == '701171341717405717'
|| reaction.emoji.id == '701171352555749498'),
{max: 1, time: 30000}).then(collected => {
if (collected.first().emoji.id == '701171382381314128') {
message.reply('Ok');
}
})
break;
break;
What line is the error occurring from according to the error message (as in the single line code)?
63 I think
Cannot read property 'emoji' of undefined
at D:\Aa Loot Tracker Bot\index.js:63:35
oh right
63 means nothing to us in this context
as in can you show the line of code
yeah so no items were collected
discord.js v11 or v12?
12
Are you sure those IDs are correct
Yes
I tried with only one ID and it worked
I've double checked several times
All id's are correct
Any idea what the problem could be
in d.js, is there a value or function to see if a message is sendable in a channel?
for instance, i can give a bot the Send Messages permission personally, but revoke it in a specific channel and run a command there, which renders message.guild.me.hasPermission('SEND_MESSAGES') useless
what was it?
for guild channels you can use channel.permissionsFor(client.user.id).has("SEND_MESSAGES")
It checked reactions on MY message... not the embed
so when I type !fk
It checks that..
Not the embed
@quartz kindle thanks
How would I change it to the embed instead?
either .then or await
Huh?
you can m.awaitReactions() after the m.reacts in that block
Ah ok
also, your reactions may be in the wrong order, idk if that matters to you
No they're in the right order?
they may be
show code
Its chaotic at the moment Ik
switch (args[0]) {
case "fk":
message.channel.send({embed: {
color: 3447003,
title: "The Forgotten King Loot",
fields: [
{value: "React with the bag you want to see what loot you've gotten from that bag!"},
]
}
}).then(m => {
m.react('701171382381314128')
m.react('701171341717405717')
m.react('701171352555749498')
m.react('701171373032079390')
m.react('701171390010622012')
m.react('701160044892258376')
message.awaitReactions((reaction, user) => user.id == message.author.id && (reaction.emoji.id == '701171382381314128' || reaction.emoji.id == '701171341717405717'
|| reaction.emoji.id == '701171352555749498' || reaction.emoji.id == '701171373032079390' || reaction.emoji.id == '701171390010622012'
|| reaction.emoji.id == '701171390010622012'),
{max: 1, time: 30000}).then(collected => {
if (collected.first().emoji.id == '701171382381314128') {
message.reply('Purple Bag');
}
if (collected.first().emoji.id == '701171341717405717') {
message.reply('Cyan Bag');
}
if (collected.first().emoji.id == '701171352555749498') {
message.reply('Blue Bag');
}
if (collected.first().emoji.id == '701171373032079390') {
message.reply('Orange Bag');
}
if (collected.first().emoji.id == '701171390010622012') {
message.reply('Red Bag');
}
if (collected.first().emoji.id == '701160044892258376') {
message.reply('White Bag');
}
});
I'm gonna clean it up as soon as I figure this out
you still have message.awaitReactions
message is your message
m is the new message
Whenever I delete a message after reacting to it I get the error "(node:15228) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Message"
I think its because its still trying to access something that was deleted
But how would I bypass this
Ah ok
the order in which js does promises is one of the mysteries of life
it does exactly as it is told :^)
how are js promises a mystery
@queen violet java?
"unable to locate or load the main class com.gamesrob.GamesROB"
Check your main class path in build.gradle
look at the left of the screenshot
the files are literally right there
the main class path is right
Is that intellij?
yes
mano isso ai é o resultado do build
Ah
to mostrando q tá la o coiso
English
kkkkk
deu na mesma
Weird
vai fica no chat bilingue mesmo kk
Mods will warn if I speak portuguese here, so...
e nós temos cert :^)
lmao
N tem logica esse erro
Ah n
Vc ta definindo certo o caminho no gradle?
Ah pera
N é possível
Tenta o seguinte
Coloca main.com.gamesrob.GamesROB
Vê se vai
Pq o root das classes é a pasta java
Ou tenta isso com.gamesrob/GamesROB
troca o javamainclass n ta mudando mais nada por alguma razao q so o diabo sabe
Então man...
Tira saporra
Kkkkk
Coloca direto no application
Apaga o bloco ext
É uma string de td modo
@craggy cave
n quer mudar a class principal nem a pau
mas so no intellij
o jar q ele builda fica com o coiso certo
Does anyone know where i can find an example of a Moderation system? Im struggling on creating one for my bot.
@clear wraith language?
qdo eu coloco com.gamesrob.GamesROB
funciona de boa no jar
mas nao qdo tento roda do intellij
Atapo
Mas tenta ainda assim krl
Kkkkk
As vezes da problema pq o processo de build e o processo de run tão sendo diferentes
discord.js @lyric mountain
@clear wraith idk, maybe tim could help u
tim is god. change my mind.
I made mine with java, so...
