makigas / discordjs-reaction-role

Add or remove roles from an user whenever reacts o unreacts to a specific message
https://www.npmjs.com/package/discordjs-reaction-role
ISC License
21 stars 5 forks source link

Adding a command to add reactionroles. #81

Open WaldperlachFabi opened 2 years ago

WaldperlachFabi commented 2 years ago

Can you add a command like !radd to add a reactionrole?

danirod commented 2 years ago

This would be an interesting concept, but because the current API of the library expects an array of reaction-roles to be given as a parameter, the !radd command needs to do something to remember the updated list of roles to use them the next time the bot starts. This is something that discordjs-reaction-role does not handle at the moment because the current API is stateless and doesn't require a persistence engine, so I don't understand how would it work out.

It should be possible to build an interaction command with something like

{
  "name": "radd",
  "description": "Add a command",
  "options": [
    {
      "type": 8,
      "name": "role",
      "description": "Role to grant or remove"
    },
    {
      "type": 3,
      "name": "emoji",
      "description": "The reaction to use as trigger"
    },
    {
      "type": 3,
      "name": "message",
      "description": "The message ID to use as trigger"
    }
  ]
}

And definitely it should be possible to rebuild the reaction-role list, persist it somewhere, and then restart the reaction role system with

let rr = new ReactionRole(client, roles);
rr.teardown();
rr = new ReactionRole(client, roles);