【发布时间】:2021-11-18 09:00:54
【问题描述】:
enter image description herethis bot 已经工作了大约 2 周,突然不上线了?终端根本没有吐出任何错误。它甚至没有记录就绪消息。我对此很陌生,所以如果您确实需要任何进一步的信息,请告诉我:)
edit:: 我已经恢复了几次令牌并自己重新邀请了机器人,但这并没有修复它:/
client.js 文件:
const {Client, Intents, Collection } = require('discord.js');
require('dotenv').config();
const client = new Client ({intents: [Intents.FLAGS.GUILDS]});
const fs = require('fs');
client.commands = new Collection();
const functions = fs.readdirSync("./src/functions").filter(file => file.endsWith(".js"));
const eventFiles = fs.readdirSync("./src/events").filter(file => file.endsWith(".js"));
const commandFolders = fs.readdirSync("./src/commands");
(async () => {
for(file of functions){
require(`./functions/${file}`)(client);
}
client.handleEvents(eventFiles, "./src/events");
client.handleCommands(commandFolders, "./src/commands");
client.on("ready", () => {
client.user.setActivity('discord.js', { type: 'WATCHING' });
});
client.login(process.env.token);
});
【问题讨论】: