![]() ![]() The default on_message does already does this for you. For any message this should only be awaited once. Remove await bot.process_commands(message) from any on_message events in your cog. Event listeners from your cog are registered on name alone Replace bot.command with mand ( commands being from discord.ext import commands)Ĭhange the signatures of your functions to include self at the beginning, as all of your commands and events are now methods of the cog classĬhange all references to bot to refer to self.bot instead There are four main transformations that you need to do to change your bot to a cog: The cog class contains all of our commands and events as methods. Almost all setup functions look the same: def setup(bot): IntroductionĮvery cog has two parts: a class and a setup function. ![]() If you're using a modern version of discord.py, you should consult the official documentation. The new 1.0 version has good documentation, and has completely changed the structure of cogs. The below was written for the older 0.16 version, which did not have good documentation of cogs. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |