Hey, i need help with a command
I am making a verify command and I would like to know how to implement that the role is given at the moment of hitting the button, because the current function is that the embed and the button are created, but it gives you the role atomatically.
(is v14.11 but i cant find the tag)
Me code: https://hastebin.com/share/emerekivog.javascript
Hastebin
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
8 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!pls the topic dont help me
You have to wait to receive the component interaction to add the role. A component interaction collector will receive the interaction from the button and you can execute any logic you need upon receiving the interaction event.
What have you tried? Are you receiving any errors?
I have not tried it because I do not understand it, I have been guided in other commands and I still do not understand how to give the role at the moment of touching the button.
You would have to create a component collector on the message with your button. You can get the message reference by awaiting the call to reply() where you send the message with the button. Use that message to create the collector as the guide shows.
It should look pretty identical to the example in the guide