This is a template to easily start developing an asynchronous bot for Telegram, using FastAPI to run the bot on a webhook and with a connected Telegram bot api
poetry install --no-root
TOKEN="154225:JjhJjllyfcchNjjkln"
RATE_LIMIT=0.7
WEBHOOK_URL="https://exemple.com"
API_ID=23523525
API_HASH="23r23sss2342245421aaaeessd55asa961eb"
REDIS_HOST="localhost"
REDIS_PORT=0000
REDIS_DB=0
TELEGRAM_BOT_API_URL="http://localhost:0000"
You will need to install ngrok
on your PC, as Webhook for Telegram has a number of conditions that you will need to take into account when placing the bot on your hosting provider, then you need to run ngrok
and specify it in WEBHOOK_URL
docker-compose up -d
poetry run fastapi run src/main.py