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, run
curl -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
-
Run pre-commit
to set up git hook scripts
pre-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 with trello integration
you need to add trello
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