mirror of
https://gitflic.ru/project/alt-gnome/karkas.git
synced 2024-12-24 00:33:06 +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,
|
register_outer_message_middleware,
|
||||||
)
|
)
|
||||||
|
|
||||||
from .main import UsersMiddleware
|
from .main import ChatsMiddleware
|
||||||
|
|
||||||
|
|
||||||
def module_init():
|
def module_init():
|
||||||
@ -12,4 +12,4 @@ def module_init():
|
|||||||
|
|
||||||
register_app_config(APP_CONFIG)
|
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):
|
async def update_chat_info(chat: Chat):
|
||||||
|
chat_name = chat.title if chat.type != "private" else ""
|
||||||
|
|
||||||
await ChatInfo.insert(
|
await ChatInfo.insert(
|
||||||
ChatInfo(
|
ChatInfo(
|
||||||
chat_name=chat.title,
|
chat_name=chat_name,
|
||||||
)
|
)
|
||||||
).on_conflict(
|
).on_conflict(
|
||||||
action="DO UPDATE",
|
action="DO UPDATE",
|
||||||
@ -19,7 +21,7 @@ async def update_chat_info(chat: Chat):
|
|||||||
).run()
|
).run()
|
||||||
|
|
||||||
|
|
||||||
class UsersMiddleware(BaseMiddleware):
|
class ChatsMiddleware(BaseMiddleware):
|
||||||
async def __call__(
|
async def __call__(
|
||||||
self,
|
self,
|
||||||
handler: Callable[[TelegramObject, Dict[str, Any]], Awaitable[Any]],
|
handler: Callable[[TelegramObject, Dict[str, Any]], Awaitable[Any]],
|
||||||
|
@ -22,4 +22,5 @@ class Singleton(metaclass=SingletonMeta):
|
|||||||
"_fsm_storage": MemoryStorage(),
|
"_fsm_storage": MemoryStorage(),
|
||||||
"_routers": [],
|
"_routers": [],
|
||||||
"_outer_message_middlewares": [],
|
"_outer_message_middlewares": [],
|
||||||
|
"metainfo": {},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user