mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-06 09:22:31 -05:00
Include bot as an argument to the cog class in the cog creation guide (#4988)
This commit is contained in:
@@ -86,6 +86,9 @@ In that file, place the following code:
|
|||||||
class MyCog(commands.Cog):
|
class MyCog(commands.Cog):
|
||||||
"""My custom cog"""
|
"""My custom cog"""
|
||||||
|
|
||||||
|
def __init__(self, bot):
|
||||||
|
self.bot = bot
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
async def mycom(self, ctx):
|
async def mycom(self, ctx):
|
||||||
"""This does stuff!"""
|
"""This does stuff!"""
|
||||||
@@ -100,7 +103,7 @@ Open :code:`__init__.py`. In that file, place the following:
|
|||||||
|
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
bot.add_cog(MyCog())
|
bot.add_cog(MyCog(bot))
|
||||||
|
|
||||||
Make sure that both files are saved.
|
Make sure that both files are saved.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user