【发布时间】:2021-01-04 23:18:44
【问题描述】:
我希望用户在我的欢迎和角色不和谐频道中选择某个反应时被分配一个角色。我到处寻找,在 python 中找不到适用于最新版本 discord.py 的代码。这是我目前所拥有的:
import discord
client = discord.Client()
TOKEN = os.getenv('METABOT_DISCORD_TOKEN')
@client.event
async def on_reaction_add(reaction, user):
role_channel_id = '700895165665247325'
if reaction.message.channel.id != role_channel_id:
return
if str(reaction.emoji) == "<:WarThunder:745425772944162907>":
await client.add_roles(user, name='War Thunder')
print("Server Running")
client.run(TOKEN)
【问题讨论】:
-
程序出了什么问题?添加反应时是否出现错误,或者代码没有执行任何操作?
-
我没有收到任何错误代码,但是是的,代码根本没有做任何事情。
标签: python python-3.x discord discord.py