Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

base usage

from aiogram import Dispatcher, Bot
from asgi_aiogram import ASGIAiogram
from asgi_aiogram.strategy import SingleStrategy
from asgi_aiogram.strategy import HttpStrategy
from asgi_aiogram.http_responses import JsonResponse
from asgi_aiogram.http_request import Request

dp = Dispatcher()

@dp.startup()
async def startup(dispatcher: Dispatcher, bot: Bot):
    await bot.close()
    await bot.set_webhook(
        url='https://example.com/bot',
        allowed_updates=dispatcher.resolve_used_update_types()
    )

async def get(request: Request):
    return JsonResponse(body={"status": "ok"})
    
bot = Bot(token="<token>")
app = ASGIAiogram(
        SingleStrategy(path="/bot", bot=bot, dispatcher=dp),
        HttpStrategy(path="/health", method="GET", handler=get),
)
uvicorn main:app

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages