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
🌟 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):
This project follows the all-contributors specification. Contributions of any kind welcome!