Discord Bot on Replit Automatically Shuts Down

I’m pretty new to programming so I need some help with this issue.

I built a Discord bot on Replit because I don’t have budget for paid hosting. The bot works fine and responds to commands with embeds. I set up proper command handling too.

The main issue is that my bot keeps shutting down automatically. It used to stay online for several hours but now it stops working after about 20 minutes. There are no error messages - when I check Replit the bot is just stopped and I need to restart it manually.

I tried the usual fixes like connecting it to UptimeRobot and adding keepAlive functions. UptimeRobot shows no downtime in the last two weeks so that’s working properly.

I tested with a simple bot that only has a ping command and it stayed online for 3 days without issues. My main bot has around 105 different commands so maybe that’s too much for Replit’s free tier to handle?

The bot isn’t getting used when it goes offline so it’s not a usage issue. Anyone know what might be causing this?

Memory’s probably killing your bot. I had the same thing happen with ~80 commands on Replit free tier. It wasn’t the command count - it’s how they load and sit in memory. Each handler (especially embeds with complex data) slowly eats RAM. Replit free has tight memory limits and kills processes without warning when you go over. Check your memory usage in console - bet you’ll see it climbing before each crash. I restructured how commands loaded and cut memory usage by 40%. Shutdowns stopped completely.

Sounds like a resource leak, not the command count. I had the same issue - turned out event listeners weren’t getting cleaned up and database connections stayed open. Your ping bot works because it’s simple, but complex bots with lots of commands usually have background stuff running that piles up over time. Set up process monitoring to track memory and CPU usage before it crashes. Also double-check you’re closing database connections, file streams, and HTTP clients when you’re done with them. These tiny leaks stack up fast on Replit’s limited resources and cause those silent crashes with no error messages.

i agree, 105 commands can be heavy for free tier. maybe try reducing them or optimizing your code. also, make sure no infinite loops are running that could cause issues. hope this helps!