#Connected more than 1000 times?
31 messages · Page 1 of 1 (latest)
• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.
Nope, currently just the ready event followed by test-emitting to some 10 or so other events
So you have absolutely no loops?
None right now, nope
or well, if you wanna be pedantic I guess, I do have a forloop over the event files
Yeah
I pass just the normal params needed for the event, and console log the params
could you show me the for loop, and maybe 1 event file?
ye sure, gimme 2 sec
index.js
[...]
const eventFiles = fs.readdirSync('./events').filter(file => file.endsWith('.js'));
for (const file of eventFiles) {
const event = require(`./events/${file}`);
if (event.once) {
client.once(event.name, (...args) => event.execute(...args));
} else {
client.on(event.name, (...args) => event.execute(...args));
}
}
[...]
ready.js
[...]
client.emit('channelCreate', {fake: "channel"});
[...]
channelCreate.js
module.exports = {
name: 'channelCreate',
once: false,
async execute(channel) {
if(channel) return console.error(`EVENT: channelCreate Error: Param Channel is null/undefined`)
console.log(`EVENT: channelCreate`)
//Send channel
//Send channel log
}
};
@white kite
(brb have to go out and get groceries)
Could it be that one of your fake emits crashes your bot and it reconnects on its own?
Speaking of reconnecting on its own, I did spot that my bot was going in and out of invisible mode
Thought it was a temp bug from discord's side so I didn't pay it any mind
However, I only test-emit once per event, and for them to emit more than once would log more than once in the console (which it doesn't)
pm2?
Relatively sure, since I reset the token just today (like 8 hours ago) :p
Do you use nodemon?
It's a process manager
