Hello Glitchers!
Can someone tell me the code on how to make the issue of the role by adding a reaction to the message, the ID of which is recorded in the quick.db table. How to make the bot add exactly the role whose ID is written in the quick.db table and by adding the reaction whose ID is also registered in the quick.db table?
You don’t need a db. You just need a reaction listener. Such as when a reaction is added, it gets the emoji I’d and compares it with different ids then once it is found it adds the role, if it is not found then it does nothing.
Please, give me example code:)
Please don’t be expected to be spoon fed
Read the documentations first, if you get stuck again you can ask us. It’s a great execise for you, you learn :
- How to read documentations
- Other stuff you might use in other projects
- How to work by yourself
- How to think about what you’re doing instead of copy/paste what we tell you to do.
- How to test stuff
And you can even improve your English.
You can’t be a programmer if you’re not the one thinking about the program.
According to V12 Discord JS Documentation. There is an method called .awaitReactions()
, which can be added to the message
object. Here is an example on how to use it:
const filter = (reaction, user) => reaction.emoji.name === 'đź‘Ť'
message.awaitReactions(filter, { time: 15000 }).then(collected => {
const reaction = collected.first();
if (reaction.emoji.name === 'đź‘Ť') {
message.reply("You give me thumbs up!");
}
}).catch(console.error);
Hope it helped, by the way I am not sure if it works because I didn’t test it.
The only thing left, is just put it in right place and fix it so it adds role instead of replying.
You’d need to get the message object. Such as client.channels.cache.get(ID)
I can’t understand anything you’re saying…can you rephrase what you just said?
Yeah I know, I only showed example on how to get reactions from a message object.
if i may… how to type it