Skip to content

Message event handling

digitalAmy edited this page Oct 14, 2020 · 2 revisions

About Modules

In ai.py we define a list of objects, called message_listeners. Message listeners are async functions, that receive the message as parameter. The message listeners are executed in sequence and when one of them returns True, subsequent message listeners are not executed for that message.

Commands

A lot of our message handling is done with discord.py commands. As we overwrote the default on_message, we also need to call bot.process_commands explicitly.