【发布时间】:2021-08-19 07:20:11
【问题描述】:
我正在创建一个不和谐机器人并正在对其进行测试。当我说 Hi 或 Yo 时,它会给我发送一个表情符号。 它工作正常,但问题是它是不断地发送表情符号。
这是我的代码:
console.log('Beep Beep! ????');
const Discord = require('discord.js');
const client = new Discord.Client(); // Client is the object that connects with the discord API itself to run the bot
client.login('API');
client.on('ready', readyDiscord);
function readyDiscord(){
console.log('????');
}
client.on('message', gotMessage);
function gotMessage(msg){
if (msg.channel.id == '849147593392914453' && msg.content === 'Hi' || 'Yo'){
// msg.reply('????????');
msg.channel.send('????????');
}
}
【问题讨论】: