File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -60,3 +60,48 @@ After:
6060 channel_id = ctx.channel_id
6161 guild_id = ctx.guild_id
6262 ...
63+
64+
65+ Cog Support
66+ ***********
67+
68+ Before:
69+
70+ .. code-block :: python
71+
72+ class Slash (commands .Cog ):
73+ def __init__ (self , bot ):
74+ if not hasattr (bot, " slash" ):
75+ # Creates new SlashCommand instance to bot if bot doesn't have.
76+ bot.slash = SlashCommand(bot, override_type = True )
77+ self .bot = bot
78+ self .bot.slash.get_cog_commands(self )
79+
80+ def cog_unload (self ):
81+ self .bot.slash.remove_cog_commands(self )
82+
83+ ...
84+
85+ After:
86+
87+ .. code-block :: python
88+
89+ class Slash (commands .Cog ):
90+ def __init__ (self , bot ):
91+ if not hasattr (bot, " slash" ):
92+ # Creates new SlashCommand instance to bot if bot doesn't have.
93+ bot.slash = SlashCommand(bot, override_type = True )
94+ self .bot = bot
95+
96+ ...
97+
98+ Note that removing `if not hasattr(...): ` block then moving to main file like this is also recommended.
99+
100+ .. code-block :: python
101+
102+ bot = commands.Bot(... )
103+ slash = SlashCommand(bot)
104+ # No worries for not doing `bot.slash` because its automatically added now.
105+ ...
106+
107+
You can’t perform that action at this time.
0 commit comments