![](/img/trans.png)
[英]How do I get my bot to respond only to reactions on a specific message? | discord.py
[英]How do I make my discord bot respond when a specific user sends a message in the channel?
每次特定用户在聊天中发送消息时,我想让我的 discord 机器人响应。 代码运行,但当该用户发送消息时没有任何反应。
这是我到目前为止所尝试的:
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.author.id == '546474118711869440':
await message.channel.send('shhhhh')
它在一个字符串中。 您必须将用户 ID 设为 int,因此不要使用引号。
if message.author.id == 546474118711869440:
await message.channel.send('shhhhh')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.