def subcommands(self):
if self._on_subcommand_page:
return None
ctx, command = self.context, self.command
assert isinstance(command, commands.GroupMixin), "command has no subcommands"
self._on_subcommand_page = True
subs = sorted(map(str, set(command.walk_commands())))
note = (
f'Type `{ctx.clean_prefix}{ctx.invoked_with} {command} subcommand`'
f' for more info on a subcommand.\n'
f'(e.g. type `{ctx.clean_prefix}{ctx.invoked_with} {random.choice(subs)}`)'
)
return (discord.Embed(colour=self.colour, description='\n'.join(map('`{}`'.format, subs)))
.set_author(name=f'Child Commands for {command}')
.add_field(name='\u200b', value=note, inline=False)
)
评论列表
文章目录