A personal Telegram bot for searching and discovering channels, built with Python using Aiogram and Telethon libraries.
- Channel Search: Search for Telegram channels using
/searchcommand - Webhook Management: Commands to manage webhook status (
/webhook_status,/webhook_off) - Admin Controls: Restrict certain commands to authorized users
- FastAPI Integration: HTTP endpoint for health checks and search API
- Deployable: Ready for deployment on Render or Railway
- Python 3.11+
- Telegram Bot Token (from @BotFather)
- Telegram API credentials (from my.telegram.org)
-
Clone the repository:
git clone https://github.com/hamad44321-eng/telegram-bot.git cd telegram-bot -
Install dependencies:
pip install -r requirements.txt
-
Configure environment variables:
cp env.example .env # Edit .env with your credentials
Set the following environment variables in your .env file:
| Variable | Description |
|---|---|
TELEGRAM_BOT_TOKEN |
Your bot token from BotFather |
API_ID |
Telegram API ID from my.telegram.org |
API_HASH |
Telegram API Hash from my.telegram.org |
ADMIN_IDS |
Comma-separated list of admin user IDs |
SEARCH_LIMIT |
Maximum number of search results (default: 20) |
PORT |
HTTP server port (default: 10000) |
# Run bot only (polling mode)
python bot.py
# Run with HTTP keepalive server (for deployments)
python keepalive.py/start- Start the bot and see available commands/ping- Check if the bot is running/search <query>- Search for Telegram channels/webhook_status- Check current webhook status/webhook_off- Disable webhook (admin only)
The project includes a render.yaml configuration for one-click deployment to Render.
See README_RAILWAY.md for Railway deployment instructions.
├── bot.py # Main bot with aiogram
├── keepalive.py # FastAPI keepalive server
├── .app.py # Alternative FastAPI app
├── requirements.txt # Python dependencies
├── render.yaml # Render deployment config
├── Procfile # Heroku/Railway process file
└── env.example # Environment variable template
This project is for personal use.