mirror of
https://gitflic.ru/project/alt-gnome/karkas.git
synced 2024-12-23 16:23:02 +03:00
мелкие правки
This commit is contained in:
parent
9c9c93edf5
commit
f5e15868f3
@ -3,7 +3,7 @@ from karkas_core.modules_system.public_api import (
|
||||
register_outer_message_middleware,
|
||||
)
|
||||
|
||||
from .main import UsersMiddleware
|
||||
from .main import ChatsMiddleware
|
||||
|
||||
|
||||
def module_init():
|
||||
@ -12,4 +12,4 @@ def module_init():
|
||||
|
||||
register_app_config(APP_CONFIG)
|
||||
|
||||
register_outer_message_middleware(UsersMiddleware())
|
||||
register_outer_message_middleware(ChatsMiddleware())
|
||||
|
@ -7,9 +7,11 @@ from .db.tables import ChatInfo
|
||||
|
||||
|
||||
async def update_chat_info(chat: Chat):
|
||||
chat_name = chat.title if chat.type != "private" else ""
|
||||
|
||||
await ChatInfo.insert(
|
||||
ChatInfo(
|
||||
chat_name=chat.title,
|
||||
chat_name=chat_name,
|
||||
)
|
||||
).on_conflict(
|
||||
action="DO UPDATE",
|
||||
@ -19,7 +21,7 @@ async def update_chat_info(chat: Chat):
|
||||
).run()
|
||||
|
||||
|
||||
class UsersMiddleware(BaseMiddleware):
|
||||
class ChatsMiddleware(BaseMiddleware):
|
||||
async def __call__(
|
||||
self,
|
||||
handler: Callable[[TelegramObject, Dict[str, Any]], Awaitable[Any]],
|
||||
|
@ -22,4 +22,5 @@ class Singleton(metaclass=SingletonMeta):
|
||||
"_fsm_storage": MemoryStorage(),
|
||||
"_routers": [],
|
||||
"_outer_message_middlewares": [],
|
||||
"metainfo": {},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user