Python 当用户对discord.py rewrite中的消息做出反应时,如何进行嵌入更改?

Python 当用户对discord.py rewrite中的消息做出反应时,如何进行嵌入更改?,python,python-3.x,discord,discord.py,discord.py-rewrite,Python,Python 3.x,Discord,Discord.py,Discord.py Rewrite,当用户对▶或◀? 这是我目前使用的代码- @client.command(aliases=['commands', 'info', 'cmds']) async def help(ctx): embed1 = discord.Embed(title=f"Everyone/Fun Commands-",description=f"```!vx userinfo [Member]```\n"

当用户对
?
这是我目前使用的代码-

@client.command(aliases=['commands', 'info', 'cmds'])
async def help(ctx):
    embed1 = discord.Embed(title=f"Everyone/Fun Commands-",description=f"```!vx userinfo [Member]```\n"
                                                                       f"**- Shows the info of the user mentioned.**\n\n"
                                                                       f"```!vx ping```\n"
                                                                       f"**- Shows the ping of the bot.**\n\n"
                                                                       f"```!vx help```\n"
                                                                       f"**- Shows a list of all commands.**\n\n"
                                                                       f"```!vx avatar [Member]```\n"
                                                                       f"**- Shows the Avatar of the mentioned user.**\n\n"
                                                                       f"```!vx hello```\n"
                                                                       f"**- Shows a hello message.**\n\n"
                                                                       f"```!vx bye```\n"
                                                                       f"**- Shows a bye message.**\n\n"
                                                                       f"```!vx mention [Member]```\n"
                                                                       f"**- Mentions the user in the server and also in DMs.**\n\n"
                                                                       f"```!vx dankmeme```\n"
                                                                       f"**- Sends a dank meme generated from r/dankmemes2.**\n\n"
                                                                       f"```!vx dm [Member] [Message Content]```\n"
                                                                       f"**- DMs the Message content to the Member mentioned.**\n\n"
                                                                       f"```!vx embed [Message Title] [Message]```\n"
                                                                       f"**- Sends an embed message in the channel.**\n\n", color=0x40cc88)
    embed1.set_thumbnail(url='https://cdn.probot.io/agdJCAIfLR.png')
    await ctx.send(embed=embed1)

    embed2 = discord.Embed(title="VX Commands-", description=f"```!vx prices```\n"
                                                             f"**- Show the official VX Price list.**\n\n"
                                                             f"```!vx portfolios```\n"
                                                             f"**- Shows the list of portfolios of VX Members.**\n\n"
                                                             f"```!vx order [Product]```\n"
                                                             f"**- Creates a ticket for you to order a product.**\n\n"
                                                             f"```!vx apply```\n"
                                                             f"**- Sends a Dm regarding info to apply for VX.**\n\n", colour=0x40cc88)
    embed2.set_thumbnail(url='https://cdn.probot.io/agdJCAIfLR.png')
    await ctx.send(embed=embed2)

    embed3 = discord.Embed(title="Mod Commands", description=f"```!vx kick [Member]```\n"
                                                             f"**- Kicks the member mentioned.**\n\n"
                                                             f"```!vx ban [Member]```\n"
                                                             f"**- Bans the member mentioned.**\n\n"
                                                             f"```!vx unban [MemberName#1234]```\n"
                                                             f"**- Unbans the member tagged.**\n\n"
                                                             f"```!vx clear [No. Of Messages]```\n"
                                                             f"**- Clears the number of messages specified.**\n\n"
                                                             f"```!vx nuke```\n"
                                                             f"**- Nukes the channel**\n\n"
                                                             f"```!vx register [Member] [Portfolio URL]```\n"
                                                             f"**- Adds the Member's Portfolio to the !vx portfolio command.**\n\n"
                                                             f"```!vx close```\n"
                                                             f"**- Closes the ticket created by a member.**\n\n"
                                                             f"```!vx spam [Member]```\n"
                                                             f"**- Spams the user in the channel and also in his dms, Only use when required.**"
                                                             f"```!vx add [Member] [Role]```\n"
                                                             f"**- Gives the role mentioned to the member.**\n\n"
                                                             f"```!vx remove [Member] [Role]```\n"
                                                             f"**- Removes the role mentioned from the meber.**", colour=0x40cc88)
    embed3.set_thumbnail(url='https://cdn.probot.io/agdJCAIfLR.png')
    embed3.set_footer(text=f"Commands requested by {ctx.author.display_name}", icon_url=ctx.author.avatar_url)
    await ctx.send(embed=embed3)
另外,我想清除用户对消息做出反应时的反应。 此外,我想只向具有管理员权限的用户显示第三个嵌入(Mod命令)。 感谢您的帮助

编辑-我知道如何更改嵌入。通常,当作者添加一个反应时,我不知道如何更改它…

也许这对您有帮助:

@bot.event
反应添加时的异步定义(反应,用户):
对于user.roles中的角色:
#管理员角色名称='test_role'
如果role.name=='test_role':
#如果用户是管理员
#做点什么
打破
其他:
#如果用户不是管理员
#并添加表情符号▶ 或◀ 有什么消息吗
if reaction.emoji=='▶':
#如果用户添加反应表情符号-▶
#做点什么
通过
elif reaction.emoji=='◀':
#如果用户添加反应表情符号-◀
#做点什么
通过

我也在想同样的事情。 我现在可以记录用户的反应,但不能清除它们,因此它们必须按两次(一次清除,然后再进行反应) 而且所有的嵌入都会在发送时进行编辑 以下是我的代码供参考:

def check(reaction, user):
        return user == author and str(reaction.emoji) in ["➡","⬅"]

    help_list=[help_embed,server_embed,greet_embed,fun_embed,music_embed,utility_embed]
    count=0
    help_msg=await ctx.send(embed=help_list[count])
    await help_msg.add_reaction("⬅")
    await help_msg.add_reaction("➡")
    
    while True:
        reaction, user = await self.bot.wait_for('reaction_add',check=check)
        print(str(reaction))
        if str(reaction.emoji) == "➡":
            count+=1
            if count>len(help_list)-1:
                count=0
            await help_msg.edit(embed=help_list[count])
            await help_msg.add_reaction("⬅")
            await help_msg.add_reaction("➡")
    
        elif str(reaction.emoji) == "⬅":
            count-=1
            if count<0:
                count=len(help_list)-1
            await help_msg.edit(embed=help_list[count])
            await help_msg.add_reaction("⬅")
            await help_msg.add_reaction("➡")
def检查(反应,用户):
return user==作者和str(reaction.emoji)在[”中➡","⬅"]
帮助列表=[帮助嵌入,服务器嵌入,问候嵌入,乐趣嵌入,音乐嵌入,实用工具嵌入]
计数=0
help\u msg=wait ctx.send(嵌入=help\u list[count])
等待帮助消息。添加反应(“⬅")
等待帮助消息。添加反应(“➡")
尽管如此:
反应,用户=等待self.bot.wait_for('reaction_add',check=check)
打印(str(反应))
如果str(reaction.emoji)=”➡":
计数+=1
如果计数>len(帮助列表)-1:
计数=0
等待帮助消息。编辑(嵌入=帮助列表[计数])
等待帮助消息。添加反应(“⬅")
等待帮助消息。添加反应(“➡")
elif str(reaction.emoji)=”⬅":
计数-=1

如果countThis不能真正回答问题。如果您有不同的问题,可以通过单击来提问。如果您有足够的问题,您也可以通过单击来吸引更多的注意力。-很抱歉,这回答了一半的问题。此代码需要用户输入反应。@Chris