我已经想出了如何在频道中添加此功能,但是我希望它可以在特定消息上使用。有人可以帮我吗?
@client.event
async def on_reaction_add(reaction, user):
channel = 'xxx'
EuMessage_id = 'xxx'
EuMsg = client.get_message(channel, EuMessage_id)
roleEU = discord.utils.get(user.server.roles, name='EU')
roleUS = discord.utils.get(user.server.roles, name='US')
roleJP = discord.utils.get(user.server.roles, name='JP')
#EU Role
if reaction.message.channel.id != EuMsg:
return #So it only happens in the specified channel
if str(reaction.emoji) == "":
print("Role EU added")
await client.add_roles(user, roleEU)