A simple Telegram bot built with pyTelegramBotAPI (telebot).
It responds to basic commands and can send a random quote from quotes.csv.
/start→ Greets the user./help→ Lists available commands./quote→ Sends a random quote and its author fromquotes.csv.- Echo mode: replies with
You write: ...to any other message.
If quotes.csv is missing or empty, the bot sends an error message.
- Python 3.10+
- A Telegram bot token (from @BotFather)
Install dependencies from requirements.txt:
pip install -r requirements.txtThe bot token is stored in a .env file:
BOT_TOKEN=123456789:ABC-DEF1234ghIkl-zyx57W2v1u123ew11
Do not commit .env to GitHub (already excluded via .gitignore).
Start the bot locally:
python main.pyExample session in Telegram:
User: /start
Bot: Hi!
User: /help
Bot: Commands: /start, /help, /quote
User: /quote
Bot: "The world as we have created it is a process of our thinking…" — Albert Einstein
telegram-quote-bot/
├─ main.py
├─ quotes.csv
├─ requirements.txt
├─ .env (not committed)
├─ .gitignore
└─ README.md
- Make sure
quotes.csvexists and has at least one row (Quote,Author). - For deployment, consider:
- Running on a server with
systemd/pm2. - Using Docker for containerized deployment.
- Switching to aiogram for async scaling.
- Running on a server with
- Always keep your bot token secret.
MIT