Teapot.py icon indicating copy to clipboard operation
Teapot.py copied to clipboard

[ENHANCEMENT] Use cogs for commands

Open flying-python opened this issue 4 years ago • 1 comments

https://github.com/RedCokeDevelopment/Teapot.py/blob/f3ba3ff43fbb9ca7d2747935ae6e62fcd28b3910/Teapot.py#L92

Many commands and events in this project does not use cogs. Usage of cogs is recommended. And also don't load commands in on_ready event when you are not using cogs.

The on_ready event may be called multiple times during the execution of the bot. When called multiple times, errors are raised if you load commands in on_ready event.

The Discord API says,

This function is not guaranteed to be the first event called. Likewise, this function is not guaranteed to only be called once. This library implements reconnection logic and thus will end up calling this event whenever a RESUME request fails.

Note: You may need to rewrite large portions of this bot to fix this issue. Make sure to test everything works in your cogs before adding them to github.

Sources:

  1. Official discord.py docs: https://discordpy.readthedocs.io/en/latest/api.html#discord.on_ready

flying-python avatar May 29 '21 03:05 flying-python

I will open a pull request for this

Dremixbotdev avatar Jun 01 '21 03:06 Dremixbotdev