I am still fairly new to making discord bots, and I have come across a bug that I haven’t seen anywhere else with conditions matching mine. When I attempt to run my code, the command for the client being ready never runs. I have seen suggestions about ratelimits, but I have no other bots running, even after waiting for a long period of time. My code is linked below. In there you can see several of my other methods I have tried for initializing a client that I have seen online, but all of them either result in silence as well or error out.
I think your code goes right, but your discord bot token is wrong, You might want to go and check your discord bot token again in Discord developer portal.
replit shares IPs, so the requests from each add up, and there are many spamming discord bots hosted on replit that ruin it for their IP. You can use
dis-uniter, which restarts your repl when there’s a rate limit to get you on a new IP. In shell:
sed -i '/^\s*client.login(/s/^\s/require("replit-dis-uniter")(client);\n/' *.js
You should check the bot token again!
It seems like you are having an issue with Discord’s rate limits. As suggested by @UMARismyname you can use an external package. But I suggest running
kill 1 in the shell which stops the first process and changes the IP of your reply.
- Check your token and reset it!
- Check your gateway intents!
- Use the
kill 1 command in the shell!
This can help with debugging.
client.on("debug", (x) => console.log(x))