In this lesson, you’ll learn how to make your bot respond to specific messages in a chat. You’ll add on to the previous functionality of your bot by handling the on_message()
event.
Because a Client
can’t tell the difference between a bot user and a normal user account, your on_message()
handler should protect against a potentially recursive case where the bot sends a message that it might handle itself. You’ll learn how to compare the message.author
to the client.user
(your bot user), and ignore any of its own messages.