示例#1
0
    async def send_group_help(self, group: commands.Group):

        ctx = self.context

        filtered_commands = []

        for command in group.walk_commands():

            if ctx.author.id in ctx.bot.config.owner_ids:
                filtered_commands.append(
                    command)  # Show all commands if author is owner.
            elif command.hidden or command.root_parent and command.root_parent.hidden:
                continue  # Skip command if it or its parents are hidden.
            else:
                filtered_commands.append(command)

        if not filtered_commands:
            return await ctx.send(
                'That command has no subcommands that you are able to see.')

        command_help = group.help if group.help else 'No help provided for this command.'
        aliases = f'**Aliases:** {"/".join(group.aliases)}\n\n'

        title = f'{group.name} {group.signature if group.signature else ""}'
        header = f'{aliases if group.aliases else ""}{command_help}\n\n__**Subcommands:**__\n'
        entries = self.format_commands(command_list=filtered_commands)

        await ctx.paginate_embed(entries=entries,
                                 per_page=20,
                                 title=title,
                                 header=header)
示例#2
0
 async def send_group_help(self, group: commands.Group):
     embed = Embed(group.short_doc,
                   group.help if group.help != group.short_doc else '')
     embed.description += '\n\nSubcommands:\n'
     for cmd in group.walk_commands():
         embed.description += f'**{cmd.name}**: {cmd.short_doc}\n'
     if group.aliases:
         embed.add_field('Aliases', ', '.join(group.aliases))
     await self.context.reply(embed=embed)
示例#3
0
文件: bot.py 项目: 5t0n3/AuthBot
    async def send_group_help(self, group: commands.Group):
        help_embed = discord.Embed(
            title=
            f"`{self.context.prefix}{group.qualified_name}` Help - Subcommands",
            color=discord.Color.gold())

        for cmd in group.walk_commands():
            help_embed.add_field(
                name=f"`{self.context.prefix}{cmd.qualified_name}`",
                value=cmd.short_doc or "None",
                inline=False)

        await self.context.send(embed=help_embed)

        return None
示例#4
0
    async def send_group_help(self, group: Group):
        _ = await self.context.get_translate_function()
        embed = discord.Embed(title=group.qualified_name,
                              description=group.description)
        for command in group.walk_commands():
            if isinstance(command, Command
                          ) and not command.hidden and command.parent == group:
                if command.short_doc:
                    embed.add_field(name=self.get_command_signature(command),
                                    value=command.short_doc)
                else:
                    embed.add_field(name=self.get_command_signature(command),
                                    value=_("No help available."))
            elif isinstance(command, Group) and not command.hidden:
                if command.help:
                    embed.add_field(name=command.qualified_name,
                                    value=command.help)
                else:
                    embed.add_field(name=command.qualified_name,
                                    value=_("No help available."))

        channel = self.get_destination()
        await channel.send(embed=embed)