当前位置: 首页>>代码示例>>Python>>正文


Python commands.is_owner方法代码示例

本文整理汇总了Python中discord.ext.commands.is_owner方法的典型用法代码示例。如果您正苦于以下问题:Python commands.is_owner方法的具体用法?Python commands.is_owner怎么用?Python commands.is_owner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在discord.ext.commands的用法示例。


在下文中一共展示了commands.is_owner方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: echo

# 需要导入模块: from discord.ext import commands [as 别名]
# 或者: from discord.ext.commands import is_owner [as 别名]
def echo(self, ctx, channel, *, message):
        """
        Echoes a string into a different channel
        :params channel: channel to echo into params message: message to
        :echo
        """
        is_owner = await ctx.bot.is_owner(ctx.author)
        if not is_owner:
            return
        if not ctx.message.channel_mentions:
            return await ctx.send(
                f'<command> <channel mention> <message> u idiot')
        try:
            for channel in ctx.message.channel_mentions:
                await channel.send(f'{message}')
        except Exception as e:
            self.logger.warning(f"Error while echoing: {e}")
            await ctx.send('Error when trying to send fam') 
开发者ID:dashwav,项目名称:nano-chan,代码行数:20,代码来源:owner.py

示例2: makedoc

# 需要导入模块: from discord.ext import commands [as 别名]
# 或者: from discord.ext.commands import is_owner [as 别名]
def makedoc(self, ctx):
        cogs = {name: {} for name in ctx.bot.cogs.keys()}

        all_commands = []
        for command in ctx.bot.commands:
            all_commands.append(command)
            if isinstance(command, commands.Group):
                all_commands.extend(command.commands)

        for c in all_commands:
            if c.cog_name not in cogs or c.help is None or c.hidden:
                continue
            if c.qualified_name not in cogs[c.cog_name]:
                skip = False
                for ch in c.checks:
                    if 'is_owner' in repr(ch):  # mine. don't put on docs
                        skip = True
                if skip:
                    continue
                help = c.help.replace('\n\n', '\n>')
                cogs[c.cog_name][
                    c.qualified_name] = f'#### {c.qualified_name}\n>**Description:** {help}\n\n>**Usage:** `{ctx.prefix + c.signature}`'

        index = '\n\n# Commands\n\n'
        data = ''

        for cog in sorted(cogs):
            index += '- [{0} Commands](#{1})\n'.format(cog, (cog + ' Commands').replace(' ', '-').lower())
            data += '## {0} Commands\n\n'.format(cog)
            extra = inspect.getdoc(ctx.bot.get_cog(cog))
            if extra is not None:
                data += '#### ***{0}***\n\n'.format(extra)

            for command in sorted(cogs[cog]):
                index += '  - [{0}](#{1})\n'.format(command, command.replace(' ', '-').lower())
                data += cogs[cog][command] + '\n\n'

        fp = io.BytesIO((index.rstrip() + '\n\n' + data.strip()).encode('utf-8'))
        await ctx.author.send(file=discord.File(fp, 'commands.md')) 
开发者ID:henry232323,项目名称:RPGBot,代码行数:41,代码来源:misc.py

示例3: cog_check

# 需要导入模块: from discord.ext import commands [as 别名]
# 或者: from discord.ext.commands import is_owner [as 别名]
def cog_check(self, ctx):
        return await self.bot.is_owner(ctx.author) 
开发者ID:FrenchMasterSword,项目名称:RTFMbot,代码行数:4,代码来源:owner.py


注:本文中的discord.ext.commands.is_owner方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。