当有人对消息做出反应时,我一直在尝试让我的机器人回复。这是我的密码->
@client.event
async def on_reaction_add(reaction, user):
channel = reaction.message.channel
await client.send_message(channel, '{} has added {} to the message {}',format(user.name, reaction.emoji, reaction.message.content))
有人能告诉我为什么我的await client.send_message
不工作吗?
也许您正在使用旧版本库的代码?send
是Channel
的方法,而不是Client
。
@client.event
async def on_reaction_add(reaction, user):
channel = reaction.message.channel
await channel.send('{} has added {} to the message {}'.format(
user.name, reaction.emoji, reaction.message.content
))
应该有效。