我如何解决此命令以应对反应? discord.py

时间:2020-10-02 20:28:55

标签: python discord discord.py discord.py-rewrite

我有一个命令,该命令可以充当一个角色,询问您角色的名称,颜色代码,然后发送一条消息,询问该角色应具有的权限,而我现在唯一拥有的是管理员,您对计算机表情做出了反应,这应该让管理员担任该角色,但事实并非如此,我的机器人具有管理员权限,因此这不是问题,也没有错误,对复选标记表情做出反应也应该完成命令关闭,但也无济于事。

这是命令:

    @commands.guild_only()
    @commands.command(aliases=["cr"], hidden=True)
    @permissions.has_permissions(administrator=True)
    async def make_role(self, ctx):
        """ Create a role with any name and color """
        def check(m):
            print(m.channel == ctx.channel)
            print(m.author == ctx.author)
            return m.channel == ctx.channel and m.author == ctx.author
        await ctx.send("What do you want the role name to be?")
        name = await self.bot.wait_for("message", check=check)
        await ctx.send("What color should the role be?")
        colour = await self.bot.wait_for("message", check=check)
        role = await ctx.guild.create_role(name=name.content, colour=discord.Colour(int("0x"+colour.content, base=16)))
        await ctx.send(f"Alright, role with {name.content} has been made.")
        dict = {"?": discord.Permissions(administrator=True), "✅": "Finished"}
        perms = []
        message = await ctx.send("? - Administrator\n✅ - Finished")
        for emoji in dict.keys():
            await message.add_reaction(emoji)
        while True:
            def check(reaction, user):
                return str(reaction.emoji) in dict.keys() and user == ctx.author
            permission_choice = await self.bot.wait_for("reaction_add", check=check)
            permission_choice = str(permission_choice[0].emoji)
            if dict[permission_choice] != "Finished":
                perms.append(dict[permission_choice])
            else:
                break
        for perm in perms:
            role.edit(permissions=perm)```

0 个答案:

没有答案