mirror of
https://github.com/lifegpc/pythonscript.git
synced 2026-06-06 11:28:58 +08:00
allow search public chats
This commit is contained in:
@@ -28,8 +28,13 @@ async def get_chat_id_from_name(lib: TdLib, name: str) -> int:
|
||||
raise ValueError('Can not found chat.')
|
||||
le = len(re['chat_ids'])
|
||||
if le == 0:
|
||||
raise ValueError('No chat found.')
|
||||
elif le == 1:
|
||||
re = await lib.searchPublicChats(name)
|
||||
if re is None:
|
||||
raise ValueError('Can not search public chats.')
|
||||
le = len(re['chat_ids'])
|
||||
if le == 0:
|
||||
raise ValueError('No chat found.')
|
||||
if le == 1:
|
||||
return re['chat_ids'][0]
|
||||
else:
|
||||
raise NotImplementedError('Multiply chat is returned.')
|
||||
|
||||
Reference in New Issue
Block a user