Discord.py - 如何使"client"变量支持"message"?



当有人对消息做出反应时,我一直在尝试让我的机器人回复。这是我的密码->

@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不工作吗?

也许您正在使用旧版本库的代码?sendChannel的方法,而不是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
))

应该有效。

最新更新