Skip to main content

Framework/toolkit for building Telegram bots with telebot and redis

Project description

telebot-components

Framework / toolkit for building bots with telebot.

Development

Setup

  1. Clone repository

    git clone git@github.com:bots-against-war/telebot-components.git baw
    cd ./baw
    
  2. 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
    
  3. 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
      
  4. 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:

  1. 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.

  2. 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
    
  3. 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

telebot_components-0.12.7.tar.gz (172.8 kB view details)

Uploaded Source

Built Distribution

telebot_components-0.12.7-py3-none-any.whl (189.7 kB view details)

Uploaded Python 3

File details

Details for the file telebot_components-0.12.7.tar.gz.

File metadata

  • Download URL: telebot_components-0.12.7.tar.gz
  • Upload date:
  • Size: 172.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for telebot_components-0.12.7.tar.gz
Algorithm Hash digest
SHA256 a2d2e292ab07ea40ac7dbb1a927333b6507262f1a13e83d237c8330381f84b6b
MD5 569b795efb3f0173847239b6010af925
BLAKE2b-256 8a60339c7d8d535d8cc58583357dab5d2093da30952b5d6b1ffba397eefa86f6

See more details on using hashes here.

File details

Details for the file telebot_components-0.12.7-py3-none-any.whl.

File metadata

File hashes

Hashes for telebot_components-0.12.7-py3-none-any.whl
Algorithm Hash digest
SHA256 f3562adda6d086a1afb4cdb78f920178a67efa007a3785ed0d2561f1652c3b83
MD5 90a3771877ccc3ec6aa017f7c89f3b73
BLAKE2b-256 d8104ca68d85c5edb9f385796320bdd0c09c3af5f3a06fa54ce3ac47709f1210

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page