Skip to content
← Back to Community
Discord.js bot will not login to client user; why?
Profile icon
h
has Hacker Plan
YodaCode

EDIT: This is a replit IP ratelimit. nothing you can do

So I have a Discord bot, and it's been working just fine. I've had it running for 28 days now, and it's done just fine. But now, for random periods of time, it stops responding to the client and when I restart it the client never logs in and never fires the ready event. I have no idea why this is happening, and I'm worried that this might be a rate limit. But at the same time, I have another instance going that is exclusively for music commands, but that is working just fine, so it can't be an issue with a rate limit or bad token.

Voters
Profile icon
AngelNext
Profile icon
IHZAQSTORM33
Profile icon
jamesrom
Profile icon
MCElite
Profile icon
LROTP
Profile icon
YodaCode
Comments
hotnewtop
Profile icon
YodaCode

Solution

Don’t run two instances of your bot, first of all. Discord.js won’t be able to communicate ratelimits across the instances. Secondly, you’ll want to kill the bot’s repl container when there’s an IP rate limit from discord. Something as simple as listening to the client’s debug event for “429 on /client/login” or something, and then use the child_process module to run the “kill 1” command.

Profile icon
colonial345

@YodaCode "kill 1" works - thanks.

Profile icon
SixBeeps

@colonial345 It's weird saying this as the infamous Repl Talk answerer, but this helped me. Shoulda tried to begin with...

Profile icon
aspect30

same

Profile icon
EnzoTDZ

@aspect30 found a work around yet or?

Profile icon
YodaCode

@EnzoTDZ I just added a solution

Profile icon
ArkadeStudios28
Profile icon
santigo171

Same

Profile icon
ArkadeStudios28

same