add an option to delete command message

This commit is contained in:
2021-12-15 13:26:21 +08:00
parent 7f794636af
commit 07b9d4f240
2 changed files with 14 additions and 7 deletions

View File

@@ -9,7 +9,7 @@ from random import random
import sys
from threading import Thread
from traceback import print_exc
from typing import List
from typing import List, Union
tdjson_path = find_library('tdjson')
@@ -532,8 +532,11 @@ class TdLib:
print(f"{re['code']} {re['message']}")
return False
async def deleteMessages(self, chat_id: int, message_ids: List[int],
async def deleteMessages(self, chat_id: int,
message_ids: Union[List[int], int],
revoke: bool = True):
if isinstance(message_ids, int):
message_ids = [message_ids]
re = await self._send({"@type": "deleteMessages", "chat_id": chat_id,
"message_ids": message_ids, "revoke": revoke})
if re['@type'] == 'ok':