我想发出一个命令,让机器人只回复某个用户 ID。但我很困惑如何做到这一点(仅供参考,我是 JS 的新手)
const userID = '<@4608164XXX93150209>'
bot.on("message", function(message){
if(!message.author === userID)
{
if(message.content === 'psst')
{
message.channel.send('Hello there!');
}
}});
原文由 Ad S.S 发布,翻译遵循 CC BY-SA 4.0 许可协议
回复有点晚,但我有同样的问题,我使用了
msg.sender
而不是msg.author
请注意
msg.sender
是一个字符串而不是数字