Include bot as an argument to the cog class in the cog creation guide (#4988)

This commit is contained in:
jack1142 2021-04-17 22:37:59 +02:00 committed by GitHub
parent 5de65a74b5
commit 0447b5648a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,6 +86,9 @@ In that file, place the following code:
class MyCog(commands.Cog):
"""My custom cog"""
def __init__(self, bot):
self.bot = bot
@commands.command()
async def mycom(self, ctx):
"""This does stuff!"""
@ -100,7 +103,7 @@ Open :code:`__init__.py`. In that file, place the following:
def setup(bot):
bot.add_cog(MyCog())
bot.add_cog(MyCog(bot))
Make sure that both files are saved.