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


Python checks.mod_or_permissions方法代码示例

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


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

示例1: run_iosfix

# 需要导入模块: from cogs.utils import checks [as 别名]
# 或者: from cogs.utils.checks import mod_or_permissions [as 别名]
def run_iosfix(self, ctx: Context, *members: discord.Member):
        """Actual fix to allow members without the bot commander to run on themselves."""
        for member in members:
            roles = member.roles.copy()
            for role in roles:
                if not role.is_everyone:
                    try:
                        await self.bot.remove_roles(member, role)
                        await self.bot.add_roles(member, role)
                        await self.bot.say(
                            "Removed and re-added {} to {}.".format(
                                role, member))
                    except discord.errors.Forbidden:
                        await self.bot.say(
                            "I am not allowed to remove {} from {}.".format(
                                role, member))

    # @checks.mod_or_permissions(manage_roles=True) 
开发者ID:smlbiobot,项目名称:SML-Cogs,代码行数:20,代码来源:racf.py

示例2: toprole

# 需要导入模块: from cogs.utils import checks [as 别名]
# 或者: from cogs.utils.checks import mod_or_permissions [as 别名]
def toprole(self, ctx, member: discord.Member = None):
        """Return top role of self (or another member).
        
        Written mostly for debugging Discord’s odd behavior.
        """
        if member is None:
            member = ctx.message.author
        await self.bot.say(member.top_role.name)

    # @checks.mod_or_permissions(manage_roles=True) 
开发者ID:smlbiobot,项目名称:SML-Cogs,代码行数:12,代码来源:racf.py

示例3: recruit

# 需要导入模块: from cogs.utils import checks [as 别名]
# 或者: from cogs.utils.checks import mod_or_permissions [as 别名]
def recruit(self, ctx, member: discord.Member = None, tag=None):
        """Add recruit tag."""
        if member is None:
            await self.bot.send_cmd_help(ctx)
            return

        verified = await check_manage_roles(ctx, self.bot)
        if not verified:
            return

        channel = ctx.message.channel

        tag = clean_tag(tag)

        # run verify if tag is provided
        if tag is not None:
            await ctx.invoke(self.racf_verify, member, tag)

        # Send visitor rule if in welcome
        # elif channel.name == 'welcome':
        #     await ctx.invoke(self.visitor, member)

        recruit_role = discord.utils.get(ctx.message.server.roles, name='Recruit')
        recruit_channel = discord.utils.get(ctx.message.server.channels, name='recruit')
        await self.bot.add_roles(member, recruit_role)
        await self.bot.say("Added Recruit to {}".format(member))

        # Add player profile to recruit channel automatically
        if tag is not None:
            await self.bot.send_message(
                recruit_channel,
                "{member.mention} Thank you for your interest! "
                "Our leaders will review your profile and let you know if you have been accepted. "
                "https://royaleapi.com/player/{tag}".format(member=member, tag=tag)
            )
            cwready = self.bot.get_cog("CWReady")
            data = await cwready.fetch_cwready(tag)
            hist = await cwready.fetch_cw_history(tag)
            await self.bot.send_message(
                recruit_channel,
                embed=await cwready.cwready_embed(data, hist)
            )
            await cwready.send_cwr_req_results_channel(
                recruit_channel,
                data
            )

        else:
            await self.bot.send_message(
                recruit_channel,
                "{member.mention} Thank you for your interest! Please type "
                "`!pt PlayerTag` at {channel.mention} — for example, type `!pt C0G20PR2` if that’s your tag. "
                "Our leaders will review your profile and let you know if you have been accepted."
                "".format(member=member, channel=recruit_channel)
            )

    # @checks.mod_or_permissions(manage_roles=True) 
开发者ID:smlbiobot,项目名称:SML-Cogs,代码行数:59,代码来源:racf.py


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