In this lesson, you’ll modify your code to listen for and then respond to events. An event is something that happens on Discord that you can use to trigger a reaction in your code.
Continuing to build on the previous code you’ve been working with, the on_ready()
event handler handles the event that the Client
has made a connection to Discord and prepared its response data. So, when Discord fires an event, discord.py
will route the event data to the corresponding event handler on your connected Client
.
Jeff on Dec. 21, 2020
If you’re not receiving a DM from your bot, and you are using discord.py v1.5.0 or above, see the docs for Gateway Intents.
You’ll need to add: