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.
This commit is contained in:
parent
26b1287a5b
commit
51b71f1dce
1 changed files with 2 additions and 1 deletions
3
main.py
3
main.py
|
|
@ -3201,7 +3201,8 @@ async def search_public_chats(query: str) -> str:
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
result = await client(functions.contacts.SearchRequest(q=query, limit=20))
|
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:
|
except Exception as e:
|
||||||
return log_and_format_error("search_public_chats", e, query=query)
|
return log_and_format_error("search_public_chats", e, query=query)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue