IvanBayan / telegram-bot-template

SQLAlchemy + python-telegram-bot template.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Telegram Bot Template Built on: Telegram Bot Template Code style: Black

SQLAlchemy bot template with simple console line interface.

Usage:

First of all, you need to set DB_URI environment variable, sqlite here for ex.:

export DB_URI=sqlite:////tmp/test.sqlite

Or add argument to command:

python -m bot .. --db-uri sqlite:////tmp/test.db

SQLAlchemy supports PostgreSQL, MySQL, SQLite, Oracle, etc.. You can read here about supported database drivers

Then, you need to set TOKEN env var:

export TOKEN=123456:AAaaaaaaaaaaaaaaaaaaaaaaaaaa

You can get your bot token from @BotFather.

Database setup:

python -m bot setup-database

Also, you can drop all data before proceed database setup, if you pass --rm flag.

Start bot with local webhook server

python -m bot start-webhook --port 8080

I prefer to use nginx as reverse proxy for mine telegram bots.

Start bot with polling worker

python -m bot start-polling

About

SQLAlchemy + python-telegram-bot template.

License:MIT License


Languages

Language:Python 90.3%Language:Mako 5.4%Language:Dockerfile 4.3%