illvart / tg-serverless

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

Home Page:https://tg-serverless.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

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

https://tg-serverless.vercel.app

License:MIT License


Languages

Language:Python 74.4%Language:HTML 21.6%Language:Shell 4.0%