Skip to content
This repository has been archived by the owner on Jan 2, 2022. It is now read-only.
/ tg-serverless Public archive

A Telegram bot Python 3.7+ app use Vercel as Serverless Function!

License

Notifications You must be signed in to change notification settings

illvart/tg-serverless

Repository files navigation

tg-serverless

CI Status License: MIT

A Telegram bot Python 3.7+ app use Vercel as Serverless Function!

Install dependencies

pip install -r requirements.txt
pip install -r requirements-dev.txt

Develop locally

vercel dev

Or running without vercel.

# without webhook
python -m app
# with webhook
python -m api.bot
# index webpage
python -m api.index

Linting and format code.

./lint.sh

Environment variables

At .env file or configure at vercel.

BOT_API_TOKEN=123456789:AbCdfGhIJKlmNoQQRsTUVwxyZ
WEBHOOK_HOST=https://{project_name}.vercel.app
SERVERLESS=True

Bugs

This bot was built using aiogram. Currently this bot doesn't run perfectly because vercel runtime @vercel/python does not use Python 3.7+. When access /api/bot you got errors:

[GET] /api/bot

Unable to import module 'now__handler__python': Your Python version 3.6.12 is not supported by aiogram, please install Python 3.7+

Why? It's because aiogram required Python 3.7+ and currently vercel use Python 3.6.12.

Stay tune, hopefully this request accepted.

License

This project is licensed under the MIT License. See the LICENSE file for details.