在过去的几周里,我的机器人一直无缘无故地重新启动。日志中没有任何内容说明任何类型的错误,分片只是不断重新启动,并且每 3-5 小时就会达到 1000 次登录限制。我做错了什么?
分片代码incase:
const {ShardingManager, Shard} = require("discord.js");
const botsettings = require('./botsettings.json');
const manager = new ShardingManager("./bot.js", {
token: botsettings.token,
totalShards: "auto",
});
manager.on('shardCreate', shard => {
console.log(`[${new Date().toString().split(" ", 5).join(" ")}] Launched shard #${shard.id}`);
})
manager.on('ready', () => {
console.log('Shard ready').catch(console.error);
})
manager.on('disconnect', (a, b) => {
console.log('Shard disconnected').catch(console.error);
console.log(a)
console.log(b)
})
manager.on('reconnecting', (a, b) => {
console.log('Shard reconnecting').catch(console.error);
console.log(a)
console.log(b)
})
manager.on('death', (a, b) => {
console.log('shard died').catch(console.error);
console.log(a)
console.log(b)
})
manager.spawn(this.totalShards, 5500, -1)