-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mention that a Help Command has to be added to a bot before adding it to the Cog #5154
Comments
This would be far more actionable with the related code- I have no idea what you're doing that should result in this. |
This issue is a bit too vague to be actionable and almost looks like a bug report disguised as a feature request. There is no traceback nor any mention of what's going on short of guessing. Please give more information if you want something to be done. |
I decided to revisit this issue. This code sample helps. from discord.ext.commands import Cog, HelpCommand, Bot
class CustomHelpCommand(HelpCommand):
pass
class CustomCog(Cog):
pass
chc = CustomHelpCommand()
cc = CustomCog() >>> chc.cog
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/User/.local/share/virtualenvs/PokestarBot-8lQ-e5KE/lib/python3.8/site-packages/discord/ext/commands/help.py", line 471, in cog
return self._command_impl.cog
AttributeError: 'NoneType' object has no attribute 'cog' >>> chc.cog = cc
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/User/.local/share/virtualenvs/PokestarBot-8lQ-e5KE/lib/python3.8/site-packages/discord/ext/commands/help.py", line 476, in cog
self._command_impl._eject_cog()
AttributeError: 'NoneType' object has no attribute '_eject_cog' Only when you set the HelpCommand to a bot does it create the >>> Bot("/").help_command = chc
>>> chc.cog
>>> chc.cog = cc
>>> chc.cog
<__main__.CustomCog object at 0x1124de730> |
Thanks. That helps. |
The Problem
In my extension setup code, I tried to add my help command to my Help cog and then add it to the bot. However, it expects a private variable to be present. Upon further inspection, it seems that this private variable is filled when the help command is added to the bot.
The Ideal Solution
The ideal solution is to make a note in
HelpCommand.cog
that it needs to be added to the bot before adding a Cog.The text was updated successfully, but these errors were encountered: