我无法使用它。这是我的主文件:
bootm
还有我的文件 ping.js :
const fs = require('fs');
bot.commands = new Discord.Collection();
const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));
for(const file of commandFiles) {
const command = require(./commands/${file});
bot.commands.set(command.name, command);
}
if (message.content == 'ping' || message.content == 'Ping') {
//message.channel.send('Pong');
bot.commands.get('ping').execute(message);
我收到此错误:
module.exports = {
name: 'test',
description: "Tester ting",
execute(message, args) {
message.channel.send("STOR TEST")
}
}
我试图让我的机器人生气:-)
答案 0 :(得分:2)
在您的出口声明中似乎有一些错字。您忘记了定义执行键。它应该看起来像这样:
module.exports = {
name: 'test',
description: "Tester ting",
execute: function(message, args) {
message.channel.send("STOR TEST")
}
}