Skip to main content

AioSQLiteStorage is a very good FSM Storage for Telegram bots on Python.

Project description

AioSQLiteStorage is a modern async FSM Storage for Telegram Bots on Python. It is surprisingly easy to connect and use.

Install

$ pip install sqlite-fsm-storage

Example of use in a telegram bot on aiogram:

from aiogram import Bot, Dispatcher
from aiogram.dispatcher.dispatcher import CancelledError
from sqlite_fsm_storage import AioSQLiteStorage
import asyncio

async def main():
    bot = Bot(token='YOUR_BOT_TOKEN', parse_mode='HTML')
    storage = AioSQLiteStorage()
    await storage.start()
    dp = Dispatcher(storage=storage)
    await bot.delete_webhook(drop_pending_updates=True)
    try:
        await dp.start_polling(bot, allowed_updates=['message', 'callback_query'])
    except CancelledError:
        pass
    finally:
        await bot.session.close()
        await storage.close()

if __name__ == '__main__':
    asyncio.run(main())

Developer - Blaze Egor

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

sqlite_fsm_storage-3.0.0.tar.gz (2.6 kB view details)

Uploaded Source

File details

Details for the file sqlite_fsm_storage-3.0.0.tar.gz.

File metadata

  • Download URL: sqlite_fsm_storage-3.0.0.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for sqlite_fsm_storage-3.0.0.tar.gz
Algorithm Hash digest
SHA256 e7043cab1f6876baaad7441d82a85059c15bf7b816fee5bbfcc917976c522703
MD5 8acc9900b7ca4a9784e0d4241b4d7262
BLAKE2b-256 d9def488f747dcbc5b6797c7be2f20f00f909338758d45cdb1e6100600e1ba61

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