mirror of
https://github.com/lifegpc/pythonscript.git
synced 2026-06-05 11:08:49 +08:00
add getChatHistory
This commit is contained in:
17
tdlib.py
17
tdlib.py
@@ -322,6 +322,23 @@ class TdLib:
|
||||
print(f"{re['code']} {re['message']}")
|
||||
return None
|
||||
|
||||
async def getChatHistory(self, chat_id: int, from_message_id: int = None,
|
||||
offset: int = None, limit: int = 20,
|
||||
only_local: bool = False):
|
||||
d = {"@type": 'getChatHistory', "chat_id": chat_id, "limit": limit,
|
||||
"only_local": only_local}
|
||||
if from_message_id is not None:
|
||||
d['from_message_id'] = from_message_id
|
||||
if offset is not None:
|
||||
d['offset'] = offset
|
||||
re = await self._send(d)
|
||||
if re['@type'] == 'messages':
|
||||
return re
|
||||
else:
|
||||
if re['@type'] == 'error':
|
||||
print(f"{re['code']} {re['message']}")
|
||||
return None
|
||||
|
||||
async def getMe(self):
|
||||
re = await self._send({"@type": "getMe"})
|
||||
if re['@type'] == 'user':
|
||||
|
||||
Reference in New Issue
Block a user