我希望機器人只回復某些用戶,所以我寫了這段代碼,但它不起作用。你能幫幫我嗎?
const userID = '322032528460611604'
client.on("message", function(message) {
if(!message.sender === userID) message.channel.send('Hello there!')
});
uj5u.com熱心網友回復:
我message.author.id在我的機器人中使用它,它作業得很好。
const userID = '322032528460611604'
client.on("message", function(message) {
if(message.author.id === userID)
return message.channel.send('Hello there!')
});
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/412075.html
標籤:
上一篇:如何從外部鏈接匯入Typescript或Javascript檔案?
下一篇:如何制作React搜索組件
