#Connected more than 1000 times?

31 messages · Page 1 of 1 (latest)

grave comet
#

Got a DM & an email from Discord saying my token got reset because I've connected my bot more than 1000 times within a short time (I assume 24 hours). I have only restarted my bot maybe 100 times today, if not less. Are there any other "connections" that goes under this rate-limit? Maybe events?

ruby verge
#

• 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.

white kite
#

You restarted 100 times? feelsTenseMan

#

Are there any loops anywhere?

grave comet
#

Nope, currently just the ready event followed by test-emitting to some 10 or so other events

white kite
#

So you have absolutely no loops?

grave comet
#

None right now, nope

white kite
#

🤔

#

Not even forEach?

grave comet
#

or well, if you wanna be pedantic I guess, I do have a forloop over the event files

white kite
#

yea yea

#

do you have at least 10 event files lol

grave comet
#

Yeah

white kite
#

and do you create clients within them

#

and log in there

grave comet
#

I pass just the normal params needed for the event, and console log the params

white kite
#

could you show me the for loop, and maybe 1 event file?

grave comet
#

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)

blissful raft
#

Could it be that one of your fake emits crashes your bot and it reconnects on its own?

idle ginkgo
#

Complementing, dou you have pm2?

#

And are you sure your token wasn't leaked?

grave comet
#

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)

grave comet
grave comet
idle ginkgo
#

Do you use nodemon?

idle ginkgo