當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。