{
  "id": 2062497,
  "title": "How to Stop Your Discord Bot From Sleeping on Render's Free Tier",
  "url": "https://urgent.news/2026/08/20/how-to-stop-your-discord-bot-from-sleeping-on-renders-free-tier",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-20T03:06:12.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/codenamew/how-to-stop-your-discord-bot-from-sleeping-on-renders-free-tier-4aca"
  },
  "original_language": "en",
  "account": "Discord bots deployed to Render's free tier may stop functioning due to Render checking the bot's health over HTTP and shutting down after a period without incoming traffic. The bot, which connects outward to Discord's gateway, does not open an HTTP port, leading to Render's health checker not knowing if the bot is functioning properly.\n\nTo address this issue, one can install \"staypresent,\" a library specifically designed to keep Python applications running. By installing \"staypresent[prod]\" and adding its dependency to the \"requirements.txt\" file, developers can create a new \"main.py\" file that wraps the original bot code in \"bot.py\" using staypresent.web.json(). Additionally, the PORT environment variable provided by Render should be read dynamically to bind the application to it.\n\nRender's start command should be set to \"python main.py,\" allowing the bot to run properly within the free tier. Optionally, if inactivity sleep is a concern, developers can set up a self-ping to the app's public URL using staypresent.cron(). This change will prevent Render's free tier from prematurely shutting down the bot.\n\nAfter implementing these steps, developers should verify that the bot remains healthy by checking Render's dashboard and the app's health endpoint. By following these steps, the bot should remain operational on Render's free tier without requiring any changes to the original bot code.",
  "summary": "A step-by-step tutorial to stop a discord bot from sleeping on Render's free tier — the real cause, the fix, and a working code example. How to Stop Your Discord Bot From Sleeping on Render's Free Tier You've deployed your Discord bot to Render's free tier, it worked for a bit, and now it's going offline — sometimes after a few minutes, sometimes randomly. This is one of the most common issues…",
  "key_points": [
    "Discord bots on Render's free tier may stop functioning due to health checks.",
    "Install staypresent library to keep Python applications running.",
    "Configure main.py with staypresent.web.json() and set Render start command to python main.py."
  ],
  "editors_take": "Using staypresent library and adjusting Render settings allows Discord bot developers to circumvent the platform's free tier shutdown issue, ensuring continuous bot operation without modifying original code.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}