bot.remove_command returns a dpy command object instead of None (#4636)

* remove_command returns a dpy command object

* removed typehint at remove_command

* typing

Co-authored-by: npc203 <npc203@users.noreply.github.com>
This commit is contained in:
Samuel 2020-12-16 23:01:26 +05:30 committed by GitHub
parent 6038ef5550
commit 06ba425159
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1374,14 +1374,15 @@ class RedBase(
if permissions_not_loaded: if permissions_not_loaded:
subcommand.requires.ready_event.set() subcommand.requires.ready_event.set()
def remove_command(self, name: str) -> None: def remove_command(self, name: str) -> Optional[commands.Command]:
command = super().remove_command(name) command = super().remove_command(name)
if not command: if command is None:
return return None
command.requires.reset() command.requires.reset()
if isinstance(command, commands.Group): if isinstance(command, commands.Group):
for subcommand in command.walk_commands(): for subcommand in command.walk_commands():
subcommand.requires.reset() subcommand.requires.reset()
return command
def clear_permission_rules(self, guild_id: Optional[int], **kwargs) -> None: def clear_permission_rules(self, guild_id: Optional[int], **kwargs) -> None:
"""Clear all permission overrides in a scope. """Clear all permission overrides in a scope.