Skip to main content

Package to use Django ORM as persistence engine in Python Telegram Bot

Project description

python-telegram-bot-django-persistence

PyPI - Downloads All Contributors

Do you use python-telegram-bot or aiogram with Django and want storing FSM info without additional infrastructure?
We've got you covered!

Originally, this package supported only PTB, but we added aiogram, because it is awesome!

Quickstart

📥 Install package

If you are using poetry (and if not, please, consider using it 😉):

# For python-telegram-bot
poetry add "python-telegram-bot-django-persistence[ptb]"
# For aiogram
poetry add "python-telegram-bot-django-persistence[aiogram]"

Elif you are using pip, then just enter:

pip install python-telegram-bot-django-persistence

🔌 Add the app to your Django project

Then add python_telegram_bot_django_persistence into your INSTALLED_APPS in your settings file, like so:

INSTALLED_APPS = [
    ...
    "python_telegram_bot_django_persistence",  # For python-telegram-bot
    "aiogram_djpersistence",  # For aiogram
]

☢ Migrate your database

python manage migrate

🌟 Awesome! Now use it in your bot!

python-telegram-bot

updater = Updater(bot=bot, use_context=True, persistence=DjangoPersistence())

aiogram

dp = Dispatcher(storage=DjangoStorage())

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Alexander Shishenko
Alexander Shishenko

💻 📖
Raman Hutkovich
Raman Hutkovich

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Project details


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

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file python_telegram_bot_django_persistence-0.2.1.tar.gz.

File metadata

File hashes

Hashes for python_telegram_bot_django_persistence-0.2.1.tar.gz
Algorithm Hash digest
SHA256 27d5b0e54e2f61c0b1094f88a35fcaa275bc8c40e51bcb7b2562505ae3c46045
MD5 2ce6b8b37347677bec28c956bdd05d6f
BLAKE2b-256 f8ef5a48d4aa7707b39461f8c317c764576c09c338a63e16ab175f44bf0bc5ea

See more details on using hashes here.

File details

Details for the file python_telegram_bot_django_persistence-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for python_telegram_bot_django_persistence-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9e1ff8238c159aee1b270a62c4bb988449f0bd8125c07285986b14ccceb1937c
MD5 320c7ade9a8c82651240d3b7af1ee0c2
BLAKE2b-256 e713d7031da8bb8ff590fadf30b5a9b7ab87c0f12710c46a73c8a37d7762571f

See more details on using hashes here.

Supported by

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