Discord 机器人未加载

时间:2021-04-18 06:45:04

标签: discord.js

我的不和谐机器人工作正常,但今天发生了一些事情。当我运行机器人时,事情只是加载,它只是说

The terminal

它不运行机器人。它应该记录“Beta Pog”但它没有发生在你身上吗?

我正在使用事件处理程序及其简单的 console.log()

但它不起作用,我尝试重新启动它但它仍然不起作用。

就绪事件代码

module.exports = {
    name: 'ready',
    once: true,
    execute(bot) {
        console.log(`Beta Pog`)
        bot.user.setActivity('with beta testing')
    },
};

1 个答案:

答案 0 :(得分:0)

在您对 javascript 和 discord.js 有全面的了解之前,我会避开命令处理程序。

我们无法调试您的问题,因为我们没有机器人命令处理程序代码。

这是您将如何做到这一点,使用 1 个 index.js 文件并简单地记录“beta pog”

// require packages
const Discord = require("discord.js");
// initialise the bot
const bot = new Discord.Client();

bot.on("ready", () => {
  console.log(`Beta Pog`);
  bot.user.setActivity('with beta testing');
});

我建议使用 ; 分号,它可以节省以后调试令人讨厌的错误

另外,我不熟悉 node .,请尝试长版本 node index.js 等。如果问题仍然存在,请尝试删除节点模块文件夹,然后执行 npm install 以重新创建包如果它是由损坏的包引起的。

Here 是一个简单的命令处理程序,带有可遵循的指南