NetrunHome

Bots

How to keep a Telegram bot running around the clock

· 5 min read

The most common problem for a first-time bot author: the bot replies only as long as your computer has a terminal open with the script running. Close the laptop, let it go to sleep, or lose your internet connection, and the bot goes silent. To run around the clock, it needs a computer that never turns off. Usually that means renting a VPS, setting up an environment on the server, and configuring autostart so the process comes back up on its own after a reboot.

But you can keep a bot online all the time without a server. Let us look at what stops a bot from running around the clock and how that gets solved when a platform takes care of the infrastructure.

  1. Understand why the bot shuts down#

    While the bot runs on your computer, it lives only alongside it: a shutdown, sleep mode, a dropped network, or a closed terminal, and the bot is unavailable. For it to always reply, the script has to run on a machine that never turns off and has a constant internet connection. Your laptop is not built for that.

  2. Give up on keeping the laptop switched on#

    Leaving a computer running for days on end is a poor option: it is noisy, it heats up, it reboots for updates, and on any network glitch the bot goes silent until you happen to notice. That is a fix for a couple of days, not a way to keep a bot online for good.

  3. Move the bot somewhere it runs on its own#

    The bot needs a place that starts it and brings it back up on its own if it crashes. That is exactly what Netrun does: you upload your code, the platform runs the bot on its own servers and restarts it after a failure. Your computer can be switched off the whole time — the bot keeps replying.

  4. Move the token into a secret#

    Before you put the project online, move the bot token out of your code and into an environment variable so it does not end up in the repository. When you set up the project, Netrun asks for the token and injects it as a secret — it will not sit in your code or the archive.

  5. Upload the bot and leave it running#

    Upload your code as a ZIP archive or import it from GitHub. Netrun detects the language (Python, Node.js, and others), builds the project, and starts the bot. After that you can safely close the dashboard and turn off your computer — the bot stays online.

  6. Keep the free plan limit in mind#

    On the free plan a bot runs for 24 hours and then shuts down — you get a warning shortly before that happens. Your code, settings, and token stay where they are, nothing is deleted. A day is enough to confirm that the bot builds, starts, and replies. To keep it online for good, you need the Pro plan. The reason is simple: a site can fall asleep while nobody visits it and wake up again when someone opens the link, so it only takes up room on a server while it answers. A bot is busy the whole time: it waits on Telegram itself, it has no public link, and there is nothing to wake it with. Running non-stop is exactly what you pay for on Pro.

To keep a Telegram bot running around the clock you need neither a laptop left on nor a rented server with autostart — you need a place that keeps the bot online for you. Upload your code to Netrun, and the bot will always reply, even when your computer is off.

Common questions

How do I keep the bot running when my computer is off?

You need to move the bot off your computer and onto a place that keeps it online. On Netrun you upload your code, the platform runs the bot on its own servers and restarts it after a failure, so it replies whether or not your laptop is on.

Do I need a paid plan for around-the-clock operation?

Yes — that is what the Pro plan is for: on Pro the bot runs with no time limit. On the free plan a bot runs for 24 hours and then shuts down, which is enough to try it out and see that everything starts and replies. Sites are different: they can stay on the free plan for as long as you like, because they fall asleep when idle and wake up when someone opens the link. A bot has nothing to wake it — it works on its own the whole time, waiting for messages.

Can I just leave the laptop switched on?

Technically yes, but it is unreliable: the laptop reboots for updates, goes to sleep, loses its network — and the bot goes silent. For non-stop operation it is better to move the bot to a place that never turns off.

What happens if the bot crashes with an error?

Netrun restarts a crashed project on its own. Logs are visible in the dashboard in real time, so you can look up the cause of the failure and fix your code.

Do I need to set up autostart and systemd?

No. Autostart and keeping the process alive are handled by the platform. There is no need to configure systemd, daemons, or schedulers the way you would on a regular VPS.

Get your own project online

Upload your code, answer a couple of questions and get a working link. There is a free plan

Try Netrun
All blog articles