Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement custom commands at runtime #9

Open
badBlackShark opened this issue May 8, 2018 · 0 comments
Open

Implement custom commands at runtime #9

badBlackShark opened this issue May 8, 2018 · 0 comments
Assignees
Labels
good first issue new feature A feature I'd like the bot to have, somewhen.
Milestone

Comments

@badBlackShark
Copy link
Owner

badBlackShark commented May 8, 2018

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.

@badBlackShark badBlackShark added good first issue TODO Things that will be done, but aren't yet. labels May 8, 2018
@badBlackShark badBlackShark added this to the 1.3.2 milestone May 8, 2018
@badBlackShark badBlackShark added new feature A feature I'd like the bot to have, somewhen. and removed TODO Things that will be done, but aren't yet. labels May 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue new feature A feature I'd like the bot to have, somewhen.
Projects
None yet
Development

No branches or pull requests

2 participants