DEV Community

John Wick
John Wick

Posted on

The First Thing You Should Install Before Deploying Any Python Bot

New to deploying Discord or Telegram bots? Here's the one dependency worth installing before your very first deploy — and why waiting until it breaks costs more.

The First Thing You Should Install Before Deploying Any Python Bot

There's a very predictable order most people learn bot deployment in: build the bot, deploy it, watch it mysteriously go offline, spend a weekend googling why, eventually land on the actual answer, fix it, and never make the mistake again. That whole cycle is avoidable. Here's the one thing worth installing before your first deploy, so you skip the weekend of googling entirely.

Everyone learns this lesson the hard way

Ask any bot developer with a few projects under their belt what their first deployment horror story was, and there's a good chance it's some version of "it worked locally, then I deployed it and it just... stopped." Nobody warns you about this ahead of time because it's not really a "bot development" problem — it's a hosting-platform quirk that has nothing to do with how good your code is. You find out about it the hard way, once, and then you carry that lesson into every project after.

Skip the lesson

The lesson, distilled, is this: most hosting platforms expect an HTTP port. Discord and Telegram bots don't naturally have one. Something needs to bridge that gap.

import staypresent

staypresent.run("bot.py")
Enter fullscreen mode Exit fullscreen mode

That's the whole fix. Written before your first deploy instead of after your first outage, it means you simply never experience the "why is my bot offline" panic that everyone else learns about the hard way.

It scales with you as you learn more

The nice part about starting here is you don't outgrow it. Your first bot is one file — staypresent.run("bot.py") covers it completely. Six months later, when you're running a Telegram bot and a Discord bot together, sharing a host:

staypresent.run(["telegram_bot.py", "discord_bot.py"])
Enter fullscreen mode Exit fullscreen mode

Same package, same mental model, just handling more. You never have to rip it out and replace it with something "more serious" once your project grows — it grows with you.

Free, small, and does one job well

It's not a framework you have to learn. It's not going to change how you write your bot's actual logic. It's a single dependency that solves exactly one problem — staying online — and gets out of your way for everything else.

pip install staypresent[prod]
Enter fullscreen mode Exit fullscreen mode

Install it now, before you need it. Future-you, at 11pm during your first real deploy, will be glad you did.

Top comments (0)