You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you use HelpCommand.add_check, and set to bot.help_command, it overwritten
Reproduction Steps
initialize the help command without checks kwarg
use HelpCommand.add_check, i.e in init or outside
assign to bot.help_command
Minimal Reproducible Code
help_command=commands.DefaultHelpCommand()
help_command.add_check(lambdactx: False)
print(help_command._command_impl.checks) # [<function <lambda> at 0x000001E67FEE50D0>]bot.help_command=help_commandprint(help_command._command_impl.checks) # []help_command.add_check(lambdactx: False)
print(help_command._command_impl.checks) # [<function <lambda> at 0x000001E67FEE50D0>]
Expected Results
checks should be carried over after bot.help_command is set and not get overwritten.
Actual Results
checks are overwritten when setting to bot.help_command. This results in the checks not being applied when invoking the help command.
Intents
discord.Intents.all()
System Information
Python v3.9.13-final
discord.py v2.4.0-alpha
discord.py metadata: v2.4.0a5025+g041abf8b
aiohttp v3.9.5
system info: Windows 10 10.0.22631
Checklist
I have searched the open issues for duplicates.
I have shown the entire traceback, if possible.
I have removed my token from display, if visible.
Additional Context
checks do carried over if you set the checks kwarg on command_attrs.
help_command=commands.DefaultHelpCommand(command_attrs={'checks': [lambdactx: False]})
help_command.add_check(lambdactx: False)
bot.help_command=help_commandprint(help_command._command_impl.checks) # [<function <lambda> at 0x0000027E06E35160>, <function <lambda> at 0x0000027E06F089D0>]
Happens since HelpCommand._add_to_bot only copies command_attrs but left out checks on the actual command impl here. Since command impl there gets overwritten, the checks disappear.
A simple fix would just be command.checks = self._command_impl.checks after this line but I don't like my approach
The text was updated successfully, but these errors were encountered:
Summary
When you use HelpCommand.add_check, and set to bot.help_command, it overwritten
Reproduction Steps
checks
kwargMinimal Reproducible Code
Expected Results
checks should be carried over after bot.help_command is set and not get overwritten.
Actual Results
checks are overwritten when setting to bot.help_command. This results in the checks not being applied when invoking the help command.
Intents
discord.Intents.all()
System Information
Checklist
Additional Context
checks do carried over if you set the
checks
kwarg oncommand_attrs
.Happens since
HelpCommand._add_to_bot
only copiescommand_attrs
but left outchecks
on the actual command impl here. Since command impl there gets overwritten, the checks disappear.A simple fix would just be
command.checks = self._command_impl.checks
after this line but I don't like my approachThe text was updated successfully, but these errors were encountered: