tracking first button press to do separate actions
hi, I'm trying to complete a util where:
- all members in guild have "all channels" role
- embed with 5 buttons to remove access to corresponding channels
- upon pressing any of the 5 buttons, "all channels" role will be removed, and the other 4 roles apart from the button pressed will be granted, removing access from the channel button pressed.
- pressing any of the other 4 buttons will remove corresponding roles.
- pressing a second time/disactivating the 5th button will remove the 5 roles and grant the "all channels" role
Its pretty easy to make just button grant role or button remove role, but I'm not sure how to bind these actions. Some advice or suggestions would be very helpful.
2 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!in your button interaction handler you have access to the member property (only within guilds)
What you need is a way to identify or bind the button to the specific role, for this i can suggest you to use the custom id of the button, set that to the roleId, then do whatever you need with it