Add keyword notification feature #11
No reviewers
Labels
No Label
bug
documentation
duplicate
enhancement
feature
good first issue
help wanted
invalid
question
wontfix
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: NLL/Heimdallr#11
Loading…
Reference in New Issue
No description provided.
Delete Branch "feature/keyword-notify"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR implements #5.
Allows a user to be notified when a keyword is said in the server.
Makes the following commands available:
/keyword-notify add <keyword>
: Add a keyword to be notified about./keyword-notify list
: List current keywords./keyword-notify remove <keyword>
: Remove a keyword. Uses autocompleteImplementation details
Currently, this checks for any keywords on any message sent, which could potentially be slow on larger servers. There likely isn't a way around this, as you cannot filter message events based on their contents.
The bot stores a list of keywords for each guild in-memory, stored as a dictionary with guild IDs as keys and a set of keywords as its value. If a user adds a keyword, it is added to the set. If a user removes a keyword, and it was the only user listening for the keyword in the guild, the keyword is removed from the set.
Side note: I also changed the Drone CI runner to be a x64 Azure VM instead of the RPi w/ arm64. Should result in better performance as it's no longer running on a RPi :dogehehe:.
@ -291,6 +291,7 @@ def main():
bot.load_extension("heimdallr.commands.polls")
bot.load_extension("heimdallr.commands.bot_messages")
bot.load_extension("heimdallr.commands.modmail")
bot.load_extension("heimdallr.commands.keyword_notify")V
V like Vandetta