Closed xL0b0 closed 1 month ago
seems like a issue on your end, my bot was running (similar use case as yours) for about 3 months with absolutely no issues
Which version are you / were you running? A colleague of mine experienced 1:1 the same issue
I use the latest version and no probleme with it
Issue is simply that it just doesn't crash or anything, it's just stuck and I have no idea how to fix it
show us ur code?
// Function to initialize and start the bot
async function startBot() {
try {
const client = new Client({
restGlobalRateLimit: 50,
sweepers: {
messages: { interval: 60, lifetime: 60 }
}
});
const eventsPath = path.join(__dirname, 'events');
const eventFiles = fs.readdirSync(eventsPath).filter(file => file.endsWith('.js'));
for (const file of eventFiles) {
const filePath = path.join(eventsPath, file);
const event = require(filePath);
if (event.once) {
client.once(event.name, (...args) => event.execute({ ...args, client }));
} else {
client.on(event.name, (...args) => event.execute({ ...args, client }));
}
}
await client.login(global.config.token);
} catch (error) {
console.log(error)
}
}
async function main() {
await startBot();
}
// Start the bot
main();
My main index.js code
const client = new Client({
restGlobalRateLimit: 50,
sweepers: {
messages: { interval: 60, lifetime: 60 }
}
});
const eventsPath = path.join(__dirname, 'events');
const eventFiles = fs.readdirSync(eventsPath).filter(file => file.endsWith('.js'));
for (const file of eventFiles) {
const filePath = path.join(eventsPath, file);
const event = require(filePath);
if (event.once) {
client.once(event.name, (...args) => event.execute({ ...args, client }));
} else {
client.on(event.name, (...args) => event.execute({ ...args, client }));
}
}
client.login(global.config.token);
So, is it about the way I init the client?
So, is it about the way I init the client?
I am so sorry and stupid, it's bcs of ur sweepers, remove it from the Client
- const client = new Client({
- restGlobalRateLimit: 50,
- sweepers: {
- messages: { interval: 60, lifetime: 60 }
- }
- });
+ const client = new Client({ restGlobalRateLimit: 50 });
Which package has the bugs?
The core library
Issue description
If I keep running for a few days, after some time no new messages are being mirrored anymore. I need to always restart the script, then it works right away again. Can it be fixed so it stays logged in the entire time and always sends messages ?
Code sample
No response
Package version
3.1.4
Node.js version
v20.13.1
Operating system
No response
Priority this issue should have
Low (slightly annoying)
Checklist
Additional Information
No response