upd get_callable_str async

This commit is contained in:
Alexander Kalinovsky
2025-02-13 02:00:20 +01:00
parent a0f21e0f1b
commit ca374cdea0
12 changed files with 117 additions and 83 deletions

39
main.py
View File

@@ -1,5 +1,4 @@
from typing import Annotated, Callable, Any
from typing_extensions import Doc
from typing import Callable, Any
from aiogram import Bot, Dispatcher
from aiogram.client.default import DefaultBotProperties
from aiogram.types import Message
@@ -18,37 +17,23 @@ from .model.descriptors import BotCommand
from .router import Router
class QBotApp(FastAPI):
class QBotApp[UserType: UserBase](FastAPI):
"""
Main class for the QBot application
"""
def __init__[UserType: UserBase](
def __init__(
self,
user_class: (
Annotated[
type[UserType], Doc("User class that will be used in the application")
]
| None
) = None,
user_class: UserType = None,
config: Config | None = None,
bot_start: (
Annotated[
Callable[
[
Annotated[
Callable[[Message, Any], None],
Doc("Default handler for the start command"),
],
Message,
Any,
],
None,
],
Doc("Handler for the start command"),
]
| None
) = None,
bot_start: Callable[
[
Callable[[Message, Any], tuple[UserType, bool]],
Message,
Any,
],
None,
] = None,
lifespan: Lifespan[AppType] | None = None,
*args,
**kwargs,