Guide

How to deploy a Telegram bot?

In this guide we build a bot from scratch and deploy it to EliteHost. Basic knowledge is enough — no Linux or VPS experience needed.

1

Creating a Telegram bot

in Telegram @BotFather — open it and /newbot — send the command. BotFather will ask you two things:

  • Bot name — the name users see (e.g.: My Bot)
  • Username — _bot must end with (e.g.: mening_botim_bot)

Once created, BotFather token gives you. It looks like this:

text
7123456789:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw

Never share your token

The token is your bot's password. Don't put it in your code or push it to GitHub. On EliteHost it's stored encrypted as an environment variable.
2

Writing the bot code

Below are ready examples for the most popular libraries. Name the file main.py (Python) or index.js (Node.js) — the system finds it automatically.

aiogram 3.xRecommended

main.py
# main.py
import asyncio
import logging
import os

from aiogram import Bot, Dispatcher, types
from aiogram.filters import CommandStart
from aiogram.client.default import DefaultBotProperties
from aiogram.enums import ParseMode

logging.basicConfig(level=logging.INFO)

# Token muhit o'zgaruvchisidan olinadi — kodga yozmang!
TOKEN = os.getenv("BOT_TOKEN")

if not TOKEN:
    raise RuntimeError("BOT_TOKEN o'zgaruvchisi topilmadi")

dp = Dispatcher()


@dp.message(CommandStart())
async def start(message: types.Message) -> None:
    await message.answer(
        f"Salom, <b>{message.from_user.full_name}</b>! 👋\n"
        "Men EliteHost'da ishlayapman."
    )


@dp.message()
async def echo(message: types.Message) -> None:
    await message.answer(message.text or "Matn yuboring")


async def main() -> None:
    bot = Bot(TOKEN, default=DefaultBotProperties(parse_mode=ParseMode.HTML))
    await dp.start_polling(bot)


if __name__ == "__main__":
    asyncio.run(main())

pyTelegramBotAPI

main.py
# main.py
import os
import telebot

TOKEN = os.getenv("BOT_TOKEN")
bot = telebot.TeleBot(TOKEN)


@bot.message_handler(commands=["start"])
def start(message):
    bot.reply_to(message, "Salom! Men EliteHost'da ishlayapman.")


@bot.message_handler(func=lambda m: True)
def echo(message):
    bot.reply_to(message, message.text)


# infinity_polling — tarmoq uzilsa avtomatik qayta ulanadi
bot.infinity_polling(skip_pending=True)

python-telegram-bot

main.py
# main.py
import os
from telegram import Update
from telegram.ext import Application, CommandHandler, ContextTypes


async def start(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
    await update.message.reply_text("Salom! Men EliteHost'da ishlayapman.")


def main() -> None:
    app = Application.builder().token(os.getenv("BOT_TOKEN")).build()
    app.add_handler(CommandHandler("start", start))
    app.run_polling()


if __name__ == "__main__":
    main()

Node.js (Telegraf)

index.js
// index.js
import { Telegraf } from 'telegraf';

const token = process.env.BOT_TOKEN;

if (!token) {
  throw new Error("BOT_TOKEN o'zgaruvchisi topilmadi");
}

const bot = new Telegraf(token);

bot.start((ctx) => ctx.reply("Salom! Men EliteHost'da ishlayapman."));
bot.on('text', (ctx) => ctx.reply(ctx.message.text));

bot.launch();

// To'g'ri to'xtatish
process.once('SIGINT', () => bot.stop('SIGINT'));
process.once('SIGTERM', () => bot.stop('SIGTERM'));
3

Preparing the dependencies file

For Python projects requirements.txt — create it. It lists the libraries you use with their versions:

requirements.txt
aiogram==3.15.0

And for Node.js — package.json:

package.json
{
  "name": "mening-botim",
  "version": "1.0.0",
  "type": "module",
  "main": "index.js",
  "dependencies": {
    "telegraf": "^4.16.3"
  }
}

Pin the version

aiogram==3.15.0 — pin an exact version. Otherwise your bot may break unexpectedly when the library updates.
4

Preparing the ZIP archive

Your project folder should look like this:

text
mening-botim/ ├── main.py ← entry file ├── requirements.txt ← dependencies ├── handlers/ ← additional modules (optional) │ └── admin.py └── data/ ← data files (optional)

Folder inside — select the files and zip them (not the folder itself — though the system handles both correctly).

Don't add to the archive

  • · venv/, .venv/ — virtual environment
  • · node_modules/ — installed on the server
  • · .env — enter tokens via the panel
  • · __pycache__/, .git/
5

Uploading to EliteHost

  1. In the dashboard New server → Bot Hosting — choose the plan
  2. Choose an environment: Python, Node.js, Go, PHP, Java, .NET, Rust, Bun, or Ruby
  3. Choose the version (Python 3.12 recommended)
  4. Upload the ZIP file

After uploading Elite AutoDeploy analyzes the archive and shows you the result:

Language:Python 3.12
Framework:aiogram
Entry file:main.py
Dependencies:requirements.txt (1 ta paket)
Required variables:BOT_TOKEN
6

Setting environment variables

Settings → Environment variables go to the section and enter the needed values:

text
BOT_TOKEN=7123456789:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw ADMIN_ID=123456789 DATABASE_URL=sqlite:///data/bot.db

These values are stored in the database AES-256-GCM encrypted and is decrypted only inside the container.

7

Launch and check

🚀 Launching the bot — click the button. The system will, in order:

  1. Creates the server (~30 seconds)
  2. Uploads the files
  3. Installs dependencies
  4. Starts the bot

The whole process live logs is shown. When it's done, send your bot in Telegram /start .

Bot not responding?

Bot Doctor — click the button: AI analyzes the logs and tells you the cause and the exact fix.

Common errors

Unauthorized / 401

Cause: BOT_TOKEN is wrong or revoked.

Fix: Get a fresh token from @BotFather and update it in the Environment variables section.

ModuleNotFoundError: No module named 'aiogram'

Cause: The library isn't listed in requirements.txt.

Fix: Add it to requirements.txt and click “Reinstall dependencies”.

Conflict: terminated by other getUpdates request

Cause: A bot with the same token is running somewhere else.

Fix: Stop the copy on your computer or another server.

Killed / MemoryError

Cause: The bot exceeded the plan's RAM limit.

Fix: Upgrade to a higher plan or move large data into a database.

Ready?

Deploy your bot in a few minutes. From 29,000 UZS a month.

Bot hosting plans