You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Staff should be able to create simple custom commands at runtime, which then everyone can call. Doesn't need to be anything super fancy, just a simple response on command, obviously only if the prefix of the specific server is matched.
A design could be: .cmd_add <command_name> <response>, then call by .<command_name> (assuming the default prefix here).
Commands need to be stored in the database of course. My approach would be to have unique command names on a per-server basis, and do the filtering myself when adding / deleting commands. A system that assigns commands to unique IDs would also work though, but might be problematic if duplicate names aren't handled when commands are added.
I would recommend storing the commands in an in memory data-structure (e.g. an Array of Hashes), and only queuing the database when commands are added / deleted.
Even better would be to use the SHRK.command method for registering commands, so no manual matching on every single message is needed. That also takes care of the prefix problem, since then discordrb does it for us. However, since commands don't do server matching, that would need to be handled somehow. If you use a different name for the event that gets fired when the command gets called, you can just put next if cmd_event.server.id != event.server.id or something similar.
Optional: It would be nice to have an optional --staff flag, which limits usage to the command for staff members.
The text was updated successfully, but these errors were encountered:
Staff should be able to create simple custom commands at runtime, which then everyone can call. Doesn't need to be anything super fancy, just a simple response on command, obviously only if the prefix of the specific server is matched.
A design could be:
.cmd_add <command_name> <response>
, then call by.<command_name>
(assuming the default prefix here).Commands need to be stored in the database of course. My approach would be to have unique command names on a per-server basis, and do the filtering myself when adding / deleting commands. A system that assigns commands to unique IDs would also work though, but might be problematic if duplicate names aren't handled when commands are added.
I would recommend storing the commands in an in memory data-structure (e.g. an Array of Hashes), and only queuing the database when commands are added / deleted.
Even better would be to use the
SHRK.command
method for registering commands, so no manual matching on every single message is needed. That also takes care of the prefix problem, since then discordrb does it for us. However, since commands don't do server matching, that would need to be handled somehow. If you use a different name for the event that gets fired when the command gets called, you can just putnext if cmd_event.server.id != event.server.id
or something similar.Optional: It would be nice to have an optional
--staff
flag, which limits usage to the command for staff members.The text was updated successfully, but these errors were encountered: