小编Aar*_*nJK的帖子

如何使用 Discord.py 创建“对角色做出反应”嵌入消息

我想设置一条带有表情符号的嵌入式消息,当用户单击某个表情符号时,它就会赋予他们一个角色。我一直在四处寻找帮助......

我已经获得了嵌入的消息部分,但只是不知道如何将表情符号反应添加到嵌入中,或者将其设置为在单击表情符号时授予用户角色。

@client.event
async def on_message(message) :
      #ignore this portion
 if message.author == client.user:
  return
 elif message.content.startswith("~ping"):
  await client.send_message(message.channe,"Pong!")
      #read below this now
 elif message.content.startswith("~embed"):
  emb = (discord.Embed(title="role Update", description="Use the emotes to role", colour=0x3DF270))
  await client.send_message(message.channel, embed=emb)

 elif message.content.startswith("~embedroles"):
  channel = bot.get_channel('532629344774914069')
  role = discord.utils.get(user.server.roles, name="test")
  while True:
   reaction = await client.wait_for_reaction(emoji='\N{THUMBS UP SIGN}', message=message)
   await bot.add_roles(reaction.message.author, role)
Run Code Online (Sandbox Code Playgroud)

我希望这是有道理的。这是我所指的示例... https://imgur.com/2QYCSAi

python python-3.x discord discord.py

2
推荐指数
1
解决办法
7526
查看次数

标签 统计

discord ×1

discord.py ×1

python ×1

python-3.x ×1