Python Forum
discord bot (detect when someone types certain words) - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: discord bot (detect when someone types certain words) (/thread-6868.html)



discord bot (detect when someone types certain words) - kikoko_2 - Dec-11-2017


Hello,
I am currently working on a discord bot and i have a question. how do i detect when someone in the discord chat types certain word combinations and then execute command? Anyone who knows how to make discord bot here?
Thanks!


RE: discord bot (detect when someone types certain words) - nilamo - Dec-11-2017

Without seeing any code, it'd probably look something like this:
class Bot(DiscordBotBase):
    def on_message(self, message):
        if "spammity spam" in message:
            self.send("Would you like spam with your Spam, Spam, Eggs, Bacon and Spam?")