python类group()的实例源码

points.py 文件源码 项目:ax-cogs 作者: Aioxas 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def member(self, ctx):
        """Member settings"""
        if ctx.invoked_subcommand is None or \
                isinstance(ctx.invoked_subcommand, commands.Group):
            await send_cmd_help(ctx)
points.py 文件源码 项目:ax-cogs 作者: Aioxas 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def keeper(self, ctx):
        """bookkeeper settings"""
        if ctx.invoked_subcommand is None or \
                isinstance(ctx.invoked_subcommand, commands.Group):
            await send_cmd_help(ctx)
downloader.py 文件源码 项目:Shallus-Bot 作者: cgropp 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def repo(self, ctx):
        """Repo management commands"""
        if ctx.invoked_subcommand is None or \
                isinstance(ctx.invoked_subcommand, commands.Group):
            await send_cmd_help(ctx)
            return
leveler.py 文件源码 项目:Maybe-Useful-Cogs 作者: AznStevy 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def profileset(self, ctx):
        """Profile options"""
        if ctx.invoked_subcommand is None or \
                isinstance(ctx.invoked_subcommand, commands.Group):
            await send_cmd_help(ctx)
            return
leveler.py 文件源码 项目:Maybe-Useful-Cogs 作者: AznStevy 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def rankset(self, ctx):
        """Rank options"""
        if ctx.invoked_subcommand is None or \
                isinstance(ctx.invoked_subcommand, commands.Group):
            await send_cmd_help(ctx)
            return
leveler.py 文件源码 项目:Maybe-Useful-Cogs 作者: AznStevy 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def levelupset(self, ctx):
        """Level-Up options"""
        if ctx.invoked_subcommand is None or \
                isinstance(ctx.invoked_subcommand, commands.Group):
            await send_cmd_help(ctx)
            return
leveler.py 文件源码 项目:Maybe-Useful-Cogs 作者: AznStevy 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def lvladminbg(self, ctx):
        """Admin Background Configuration"""
        if ctx.invoked_subcommand is None or \
                isinstance(ctx.invoked_subcommand, commands.Group):
            await send_cmd_help(ctx)
            return
welcome.py 文件源码 项目:Dumb-Cogs 作者: irdumbs 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def welcomeset_msg(self, ctx):
        """Manage welcome messages
        """
        if ctx.invoked_subcommand is None or \
                isinstance(ctx.invoked_subcommand, commands.Group):
            await send_cmd_help(ctx)
            return
welcome.py 文件源码 项目:Dumb-Cogs 作者: irdumbs 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def welcomeset_bot(self, ctx):
        """Special welcome for bots"""
        if ctx.invoked_subcommand is None or \
                isinstance(ctx.invoked_subcommand, commands.Group):
            await send_cmd_help(ctx)
            return
repl.py 文件源码 项目:Dumb-Cogs 作者: irdumbs 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def replset_print(self, ctx):
        """Sets where repl content goes when response is too large."""
        if ctx.invoked_subcommand is None or \
                isinstance(ctx.invoked_subcommand, commands.Group):
            await send_cmd_help(ctx)
adventure.py 文件源码 项目:Dumb-Cogs 作者: irdumbs 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def team_list(self, ctx):
        if ctx.invoked_subcommand is None or \
                isinstance(ctx.invoked_subcommand, commands.Group):
            await send_cmd_help(ctx)
welcome.py 文件源码 项目:KeekoBot 作者: DavidNeon 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def welcomeset_msg(self, ctx):
        """Manage welcome messages
        """
        if ctx.invoked_subcommand is None or \
                isinstance(ctx.invoked_subcommand, commands.Group):
            await send_cmd_help(ctx)
            return
welcome.py 文件源码 项目:KeekoBot 作者: DavidNeon 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def welcomeset_bot(self, ctx):
        """Special welcome for bots"""
        if ctx.invoked_subcommand is None or \
                isinstance(ctx.invoked_subcommand, commands.Group):
            await send_cmd_help(ctx)
            return
downloader.py 文件源码 项目:KeekoBot 作者: DavidNeon 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def repo(self, ctx):
        """Repo management commands"""
        if ctx.invoked_subcommand is None or \
                isinstance(ctx.invoked_subcommand, commands.Group):
            await send_cmd_help(ctx)
            return
drawing.py 文件源码 项目:ORELS-Cogs 作者: orels1 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def _set(self, ctx):
        """Configure build command"""

        if ctx.invoked_subcommand is None or isinstance(ctx.invoked_subcommand, commands.Group):
            await self.bot.say("Type help build set for info.")
formatter.py 文件源码 项目:aryas 作者: lattkkthxbbye 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def format(self):
        """
        Formats the help page.
        """
        # Adapted from discord.ext.commands.formatter.HelpFormatter.format

        self._paginator = AryasPaginator()

        description = self.command.description if not self.is_cog() else inspect.getdoc(self.command)

        if description:
            self._paginator.new_page(description=description)

        if isinstance(self.command, Command):
            # long help doc
            if self.command.help:
                self._paginator.add_line(self.command.help)

            self._paginator.set_name(self.get_command_signature())
            self._paginator.make_field(inline=False)

            # if it's just a single command we're done here
            if not self.has_subcommands():
                return self._paginator.pages

        # Helper method for sorting by category (cog)
        def category(tup):
            cog = tup[1].cog_name
            # Unicode invisible space is there to set No Category last
            return cog + ':' if cog is not None else '\u200bNo Category:'

        # if command is a bot we need to process the entire command list
        if self.is_bot():
            data = sorted(self.filter_command_list(), key=category)
            for category, commands in itertools.groupby(data, key=category):
                commands = list(commands)
                if len(commands) > 0:
                    self._add_entries(commands)
                    self._paginator.set_name(category)
                    self._paginator.make_field(inline=False)
        else:
            # if command is just a cog or Group we can print all the commands
            # returned by filter_command_list
            self._add_entries(self.filter_command_list())
            self._paginator.set_name('Commands:')
            self._paginator.make_field(inline=False)

        # Get the ending message
        self._paginator.set_name('More:')
        self._paginator.add_line(self.get_ending_note())
        self._paginator.make_field(inline=False)
        return self._paginator.pages
service.py 文件源码 项目:StreamNotificationBot 作者: ivandardi 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def _make_commands(self):
        group = commands.Group(
            name=self.service_name,
            callback=self._group_command,
            help=self._make_help_string(strings.group_command_help),
        )
        group.instance = self
        cmd = commands.Command(
            name='add',
            aliases=['subscribe'],
            callback=self._add_command,
            help=self._make_help_string(strings.add_command_help),
        )
        cmd.instance = self
        group.add_command(cmd)
        cmd = commands.Command(
            name='del',
            aliases=['unsubscribe', 'remove', 'delete'],
            callback=self._del_command,
            help=self._make_help_string(strings.del_command_help),
        )
        cmd.instance = self
        group.add_command(cmd)
        cmd = commands.Command(
            name='list',
            callback=self._list_command,
            help=self._make_help_string(strings.list_command_help),
        )
        cmd.instance = self
        group.add_command(cmd)
        cmd = commands.Command(
            name='enable',
            callback=self._enable_command,
            help=self._make_help_string(strings.enable_command_help),
        )
        cmd.instance = self
        group.add_command(cmd)
        cmd = commands.Command(
            name='disable',
            callback=self._disable_command,
            help=self._make_help_string(strings.disable_command_help),
        )
        cmd.instance = self
        group.add_command(cmd)

        return group


问题


面经


文章

微信
公众号

扫码关注公众号