roles.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:Chiaki-Nanami 作者: Ikusaba-san 项目源码 文件源码
def _check_role(ctx, role, thing):
    if role.managed:
        raise commands.BadArgument("This is an integration role, I can't assign this to anyone!")

    # Assigning people with the @everyone role is not possible
    if role.is_default():
        message = ("Wow, good job. I'm just gonna grab some popcorn now..."
                   if ctx.message.mention_everyone else
                   "You're lucky that didn't do anything...")
        raise commands.BadArgument(message)

    if role.permissions.administrator:
        message = ("This role has the Administrator permission. "
                   "It's very dangerous and can lead to terrible things. "
                   f"Are you sure you wanna make this {thing} role?")
        try:
            result = await ctx.ask_confirmation(message)
        except asyncio.TimeoutError:
            raise commands.BadArgument("Took too long. Aborting...")
        else:
            if not result:
                raise commands.BadArgument("Aborted.")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号