SCE-Development / SCE-discord-bot

This is the repository for the bot in the SCE discord.
MIT License
2 stars 2 forks source link

Direct message user on role assign/unassign #186

Closed evanugarte closed 3 months ago

evanugarte commented 6 months ago

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:

image

Game plan

  1. move the code that adds/removes roles to its own class called ReactionHandler, similar to src/handlers/NewMemberAddHandler.js.
  2. In the new class, create a function called handleReaction, which takes three parameters, reaction, user, and reactionWasRemoved. reactionWasRemoved will default to false
  3. move the existing role add/remove logic to this function
  4. once it works, we will open a PR to move it to a class
  5. next, lets send a user a simple dm when they react/unreact to a message, does it work?
  6. 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

here 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.

evanugarte commented 4 months ago

@DanielTQuach

evanugarte commented 3 months ago

closed by #201 and #194