From 0447b5648a80f94e707e6a6975f00000628d1eb5 Mon Sep 17 00:00:00 2001 From: jack1142 <6032823+jack1142@users.noreply.github.com> Date: Sat, 17 Apr 2021 22:37:59 +0200 Subject: [PATCH] Include `bot` as an argument to the cog class in the cog creation guide (#4988) --- docs/guide_cog_creation.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/guide_cog_creation.rst b/docs/guide_cog_creation.rst index 1c4de0210..11d724f9a 100644 --- a/docs/guide_cog_creation.rst +++ b/docs/guide_cog_creation.rst @@ -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.