From 51b71f1dced4db43bf59c706cb08e58ccb686bc9 Mon Sep 17 00:00:00 2001 From: mxl Date: Mon, 16 Mar 2026 09:27:35 +0300 Subject: [PATCH] fix: include chats and channels in search_public_chats results contacts.SearchRequest returns both result.users and result.chats, but only users were returned. Chats (channels, groups) are now included, making search work by channel/group title as intended. --- main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 1cb01c3..dcdef8f 100644 --- a/main.py +++ b/main.py @@ -3201,7 +3201,8 @@ async def search_public_chats(query: str) -> str: """ try: result = await client(functions.contacts.SearchRequest(q=query, limit=20)) - return json.dumps([format_entity(u) for u in result.users], indent=2) + entities = [format_entity(e) for e in result.chats + result.users] + return json.dumps(entities, indent=2) except Exception as e: return log_and_format_error("search_public_chats", e, query=query)