A Discord bot that only SENDS messages is all well and good, but really we want our bots to interact. We need to make them listen and respond. Let’s do that now.
Event Driven Computing
If you have done any visual or object-oriented programming you will be aware of what is called listening for or raising an “event”.
Essentially your program keeps quietly processing until something happens, then it jumps into action.
So with this in mind, we need to tell our bot what to look for and how to respond!
You will need the Discord code library before you can run any of these commands so grab it like so:
python3 -m pip install discord
Running the Bot
First, you need to create your bott app, and associate a new bot with it:
Then you need to go to the permissions URL to authorize your bot to do its thing:
When your script is running and the bot is authorized you should get notified in your server thusly: