Created
August 22, 2020 13:05
-
-
Save arturboyun/72447cb5e081a9bd6621361d9107d8ce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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