server.py 文件源码

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

项目:Cassandra 作者: Avinch 项目源码 文件源码
def remove_(self, ctx, role: Role):
        """
        Removes a role.
        Available Roles List:
            - ping
            - battlenet
        If the argument given is not a valid role in the guild, it will safely ignore it.
        If the argument is a valid role in the guild and is not in the available roles list, it will flag it as invalid.
        """
        whitelisted_roles = [
            utils.get(ctx.guild.roles, name="ping"),
            utils.get(ctx.guild.roles, name="battlenet")
        ]
        if role in whitelisted_roles:
            await ctx.author.remove_roles(role, reason="Used role command")
            await ctx.send(f"Removed `{role}` from {ctx.author.mention}.")
        else:
            await ctx.send(
                f"""
                `{role}` is not a valid role! 
                Do `{ctx.prefix}help role remove` for more information. {ctx.author.mention}
                """
            )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号