misc.py 560 B

12345678910111213141516171819202122232425
  1. from aiogram import Bot, Dispatcher
  2. from aiogram.contrib.fsm_storage.redis import RedisStorage2
  3. from aiogram.utils.executor import Executor
  4. from app import config
  5. bot = Bot(config.TELEGRAM_TOKEN)
  6. storage = RedisStorage2(
  7. host=config.REDIS_HOST, port=config.REDIS_PORT, db=config.REDIS_DB_FSM
  8. )
  9. dp = Dispatcher(bot, storage=storage)
  10. runner = Executor(dp)
  11. def setup():
  12. from app.models import db
  13. from app import middlewares
  14. from app import filters
  15. db.setup(runner)
  16. middlewares.setup(dp)
  17. filters.setup(dp)
  18. import app.handlers