- Switch to python 3.10.1, create a virtual environment, activate it, then install depedencies
python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt- If pre-commit is not yet installed run
pre-commit install - Run
pre-commit run --allbefore every commit
- To serve webhook locally, first obtain WEBHOOK_URL by running
ngrok http <PORT>and copying the public domain given by ngrok to your local env file, then start the server withpython3 main.pyon a separate terminal which sets the webhook upon bot instantiation - To serve webhook publicly, Koyeb was used to deploy the server on a public WEBHOOK_URL, which was then reconfigured in Koyeb secrets. Only after the first deployment would the webhook need to be manually set by running
curl -X POST "https://api.telegram.org/bot<TELEBOT_TOKEN>/setWebhook" \
-d url=WEBHOOK_URL \
-d secret_token=SECRET_TOKEN- Subsequently, as long as WEBHOOK_URL doesn't change, future deployments will set the correct webhook automatically