File tree Expand file tree Collapse file tree
src/python_italy_bot/services Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33from telegram import ChatPermissions
44
55from ..db .base import AsyncRepository
6- from ..db .models import KnownUser
6+ from ..db .models import Chat , KnownUser
77
88
99class ModerationService :
@@ -61,14 +61,22 @@ async def is_globally_banned(self, user_id: int) -> bool:
6161 """Check if user is globally banned."""
6262 return await self ._repo .is_globally_banned (user_id )
6363
64- async def register_chat (self , chat_id : int ) -> None :
64+ async def register_chat (self , chat_id : int , title : str | None = None ) -> None :
6565 """Register a chat where the bot is active."""
66- await self ._repo .register_chat (chat_id )
66+ await self ._repo .register_chat (chat_id , title )
6767
6868 async def get_all_chats (self ) -> list [int ]:
6969 """Get all tracked chat IDs."""
7070 return await self ._repo .get_all_chats ()
7171
72+ async def get_all_chats_with_titles (self ) -> list [Chat ]:
73+ """Get all tracked chats with their titles."""
74+ return await self ._repo .get_all_chats_with_titles ()
75+
76+ async def find_chats_by_title (self , query : str ) -> list [Chat ]:
77+ """Find tracked chats whose title contains the query (case-insensitive)."""
78+ return await self ._repo .find_chats_by_title (query )
79+
7280 async def add_mute (
7381 self ,
7482 user_id : int ,
You can’t perform that action at this time.
0 commit comments