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.1
on 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-commit
to 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
.env
file is generated you will need to add your bot's token to it.
Also for bot withtrello integration
you need to addtrello
token 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
./examples
python3 ./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
File details
Details for the file telebot_components-0.12.8.tar.gz
.
File metadata
- Download URL: telebot_components-0.12.8.tar.gz
- Upload date:
- Size: 173.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10c2889ddc369f41df161d1c7a0520e15a0cd6741e1f7bd4db88a4c1515f2b22 |
|
MD5 | b356ef027e24cedde6d8e660b3b99153 |
|
BLAKE2b-256 | 3f0270415ecab74b9c883cada45969a0554ab95abb7e13e3c84fbe06823ab30f |
File details
Details for the file telebot_components-0.12.8-py3-none-any.whl
.
File metadata
- Download URL: telebot_components-0.12.8-py3-none-any.whl
- Upload date:
- Size: 190.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 805d87b2309fbc9d13eb839715a1156cd960970b469e6fb272c70aafdfbaf5a2 |
|
MD5 | 505fd97899c09bbb73a92b6fb92c6169 |
|
BLAKE2b-256 | 1b176c2adca4fce9dff1a8dd94dd62fd223bac5c4dd401722538f9181a9e26fb |