Bot role with emoji
Hi,
I wrote the code for the bot. The essence of the code: When writing the !create command in the chat, the bot displays a message with a choice of role and reactions under it. The user clicks on a certain reaction and he is given a role.
Problem: the role is not issued, although the names of the roles are the same, the bot has administrator rights.
What is the problem? The terminal does not write errors.
![](https://cdn.answeroverflow.com/1121405695472963615/1.png)
![](https://cdn.answeroverflow.com/1121405695888195594/2.png)
10 Replies
β’ What's your exact discord.js
npm list discord.js
and node node -v
version?
β’ Post the full error stack trace, not just the top part!
β’ Show your code!
β’ Explain what exactly your issue is.
β’ Not a discord.js issue? Check out #useful-servers.[email protected]
v18.16.0
Tag suggestion for @tatina:
If you aren't getting any errors, try to place
console.log
checkpoints throughout your code to find out where execution stops.
- Once you do, log relevant values and if-conditions
- More sophisticated debugging methods are breakpoints and runtime inspections: learn moreI set the consoles, but there are no errors, what am I doing wrong?
![](https://cdn.answeroverflow.com/1121501279026421820/3.png)
![](https://cdn.answeroverflow.com/1121501279303249992/4.png)
![](https://cdn.answeroverflow.com/1121501279571689545/5.png)
can you send your code as a codeblock/pastebin
Tag suggestion for @tatina:
To share long code snippets use a service like gist, sourcebin, starbin, or similar instead of posting them as large code blocks.
Codeblocks:
```js
const Discord = require("discord.js");
// further code
```
becomes
Inline Code:
`console.log('inline!');` becomes
console.log('inline!');
you'll need the
GuildMessageReactions
intent in order to receive the messageReactionAdd
event (reaction collectors rely on this event)TypeError: collected.firstKey is not a function.
The filter for collectors has moved into the options:
How to fix it? Don't understand what I'm doing wrong. ![bonk](https://cdn.discordapp.com/emojis/1083340565283876965.png)
![flashingheart](https://cdn.discordapp.com/emojis/1085180095171403857.gif)
![bonk](https://cdn.discordapp.com/emojis/1083340565283876965.png)
![flashingheart](https://cdn.discordapp.com/emojis/1085180095171403857.gif)