How to Keep a Discord Bot Running on Render's Free Tier Using StayPresent
Discord bots deployed on Render's free tier frequently go offline because Render's health checker expects an HTTP response on an open port, which a standard discord.py bot never provides. Without a responding port, Render marks the service as unhealthy and repeatedly restarts or spins it down. The fix involves installing the StayPresent library, creating a new entry point file that binds to Render's assigned PORT environment variable and serves a basic health response, then updating the start command in Render's service settings. An optional self-ping feature can also be configured to prevent the service from sleeping due to inactivity on Render's free tier. The bot's core Discord logic requires no changes — only the entry point Render uses to launch the application is new.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in