upd get_callable_str async
This commit is contained in:
39
main.py
39
main.py
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user