pogoteams.py 文件源码

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

项目:bursting-cogs 作者: Repulser 项目源码 文件源码
def valor(self, ctx):
        user = ctx.message.author
        server = ctx.message.server
        roles = [role.name.replace('@', '@\u200b') for role in user.roles]
        if 'Valor' in roles:
            await self.bot.say("You already joined that team!")
        elif 'Mystic' in roles or 'Instinct' in roles:
            await self.bot.say("You have already joined a team please leave a team before adding a new one")
        else:
            serverroles = [role.name.replace('@', '@\u200b') for role in server.roles]
            if 'Mystic' in serverroles and 'Valor' in serverroles and 'Instinct' in serverroles:
                valor = discord.utils.find(lambda r: r.name == 'Valor', ctx.message.server.roles)
                await self.bot.add_roles(user, valor)
                await self.bot.say("Team succesfuly joined! :+1:")

            else:
                await self.bot.say("No roles found, creating them now.... ")
                valor = await self.bot.create_role(ctx.message.server)
                mystic = await self.bot.create_role(ctx.message.server)
                instinct = await self.bot.create_role(ctx.message.server)
                await self.bot.edit_role(ctx.message.server, valor, name='Valor', colour=discord.Colour(value=15995914))
                await self.bot.edit_role(ctx.message.server, mystic, name='Mystic', colour=discord.Colour(value=423919))
                await self.bot.edit_role(ctx.message.server, instinct, name='Instinct', colour=discord.Colour(value=16501507))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号