【发布时间】:2021-01-16 15:43:23
【问题描述】:
我正在使用 node.js 和 Visual Studio
机器人似乎不工作,但确实响应了节点。命令,但不响应 -ping 命令,我可以找出原因,是拼写还是更新了代码,或者我只是愚蠢,请帮忙。
const Discord = require('discord.js');
const client = new Discord.Client();
const prefix = '-';
client.once('ready', () => {
console.log('sirjunkbot is awake');
});
client.on('message', message =>{
if(!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
if(command === 'ping'){
message.channel.send('pong!');
} else if (command == 'test'){
message.channel.send('123');
}
});
【问题讨论】:
标签: node.js visual-studio-code discord