In the new class, create a function called handleReaction, which takes three parameters, reaction, user, and reactionWasRemoved. reactionWasRemoved will default to false
move the existing role add/remove logic to this function
once it works, we will open a PR to move it to a class
next, lets send a user a simple dm when they react/unreact to a message, does it work?
finally lets make use of an embed to give the user a nicely formatted message. see this screenshot and the existing music functionality for an example src/util/MusicSingleton.js:217
The bot has code to add/remove roles based on a roles reaction, see the bot's README and server.js:56.
In addition to the role assignment, lets send the user a direct message when they react/unreact to a message, to let them know their role changed.
for example:
Game plan
ReactionHandler
, similar to src/handlers/NewMemberAddHandler.js.handleReaction
, which takes three parameters,reaction
,user
, andreactionWasRemoved
.reactionWasRemoved
will default to falsehere are some more examples of embeds: https://discordjs.guide/popular-topics/embeds.html#embed-preview
Note: we may encounter issues when trying to handle unreaction events, due to cached messages. we can deal with that later.