I'm setting up a bot that pings someone if specific criteria are met. As an example, let's say the person wants to be pinged if someone says "apple" in the chat.
I'm trying to set up a system where if a person types "!ping apple" in the chat, they will be notified whenever the word "apple" appears in the chat. However, I can't figure out a way to store this information in a list based on the user automatically. What I'd like to be able to do is the following:
User says "!ping apple"
The bot appends "apple" to a list that's assigned to that person.
If "apple" is said in the chat, the bot pings that person.
Is there an way to do this (preferably efficiently)? One strategy I tried was based off of this post about renaming strings to variables (which took the user's @, cut off the @ and #xxxx, removed spaces, then turned the resulting string into a variable that contained the list) but that has the potential for creating a bunch of bugs and isn't pythonic.
One strategy that might work is to say "!ping <word> <name of user>" but that seems like I'd run into the same problem; having a string instead of a variable.