Framework/toolkit for building Telegram bots with telebot and redis
Project description
telebot-components
Framework / toolkit for building bots with telebot.
Development
Setup
-
Clone repository
git clone git@github.com:bots-against-war/telebot-components.git baw cd ./baw
-
The project requires Poerty 1.5.1 (see installation instruction). For example, to install
1.5.1on Unix, runcurl -sSL https://install.python-poetry.org | python3 - --version 1.5.1
-
Then, to install the library with all dependencies, run from project root
poetry install- You might need to manually install dynamic versioning plugin (without it local build will
always have version
0.0.0):poetry self add poetry-dynamic-versioning-plugin
- To create virtualenv inside the project’s root directory, use command
poetry config virtualenvs.in-project false --local
- You might need to manually install dynamic versioning plugin (without it local build will
always have version
-
Run
pre-committo set up git hook scriptspre-commit install
Testing
Use command below for run tests
poetry run pytest tests -vv
To also generate test coverage report
poetry run coverage run -m pytest tests -vv && poetry run coverage report
By default, all tests are run with in-memory Redis emulation. But if you want you can run them
locally on real Redis by specifying REDIS_URL environment variable before running pytest.
Note: Tests must be able to find an empty Redis DB to use; they also clean up after themselves.
Start example bot
For first start you need to do 3 things:
- Use command below to generate environment variables file:
cp ./examples/example.env ./examples/.env
Note: After
.envfile is generated you will need to add your bot's token to it.
Also for bot withtrello integrationyou need to addtrellotoken and api key. You can get it here. - If you want start redis on local machine, run
docker run --name baw-redis -d -p 6379:6379 redis redis-server --save 60 1 --loglevel warning
- Run any bot from
./examplespython3 ./examples/feedback_bot.py // or run with IDE from bot file
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for telebot_components-0.12.5.tar.gz
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | 9da7c65c55636c10a62260afda64e348826f62a5acef0dcee3a37d3936c9c887 |
|
| MD5 | bd8204854c9d7bf91f19672db969800f |
|
| BLAKE2b-256 | 4b843ca4996d3b1d2140bdd94da851ce71f68f5b5d2ee456f9eac5ef247555fc |
Hashes for telebot_components-0.12.5-py3-none-any.whl
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | ebaa801735a5c1c2a0bf592c1c3474061fd50474fc3c8fc94567816065f1bd3c |
|
| MD5 | b0110af510693f0a5e07e545fa5e9d31 |
|
| BLAKE2b-256 | a0c94f182a1107f08ae371117a6da2b066f70682dc2f5a83725abbf50c97eece |