TCLRainbow / DimBot

A Discord bot that does a lot of stuff
https://discord.com/api/oauth2/authorize?client_id=574617418924687419&permissions=1999957094&scope=bot
3 stars 2 forks source link

Simplify on_ready() design for cogs #47

Closed Pythonic-Rainbow closed 3 years ago

Pythonic-Rainbow commented 3 years ago
async def load_cogs():
  bot.add_cog(ricciardo.Ricciardo(bot))
  bot.add_cog(hamilton.Hamilton(bot))
  bot.add_cog(verstapen.Verstapen(bot))
  bot.add_cog(bot.echo)
  bot.add_cog(norris.Norris(bot))
bot.loop.create_task(load_cogs())
bot.run()

This allows each cog to remove on_ready() because fetching channels can be directly coded in __init__

Pythonic-Rainbow commented 3 years ago

https://github.com/TCLRainbow/DimBot/commit/58dddcd498fa05556c363716c244a80248773d8d