Skip to content

Instantly share code, notes, and snippets.

@arturboyun
Created August 22, 2020 13:05
Show Gist options
  • Save arturboyun/72447cb5e081a9bd6621361d9107d8ce to your computer and use it in GitHub Desktop.
Save arturboyun/72447cb5e081a9bd6621361d9107d8ce to your computer and use it in GitHub Desktop.
from aiogram.types import Update
from fastapi import APIRouter
from app.bot.bot import dp
from app.config import config
router = APIRouter()
def get_dispatcher():
from aiogram import Dispatcher, Bot
Dispatcher.set_current(dp)
Bot.set_current(dp.bot)
return dp
@router.post(config.bot_webhook_endpoint)
async def bot_webhook(data: dict):
update = Update(**data)
await get_dispatcher().process_update(update)
return update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment