mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 20:14:51 +00:00
Add delete parameter to delete the chat dialog
This commit is contained in:
parent
924302aed5
commit
6b9a757ce7
1 changed files with 12 additions and 2 deletions
|
|
@ -959,7 +959,7 @@ class Client:
|
|||
)
|
||||
)
|
||||
|
||||
def leave_chat(self, chat_id: int or str):
|
||||
def leave_chat(self, chat_id: int or str, delete: bool = False):
|
||||
peer = self.resolve_peer(chat_id)
|
||||
|
||||
if isinstance(peer, types.InputPeerChannel):
|
||||
|
|
@ -969,9 +969,19 @@ class Client:
|
|||
)
|
||||
)
|
||||
elif isinstance(peer, types.InputPeerChat):
|
||||
return self.send(
|
||||
r = self.send(
|
||||
functions.messages.DeleteChatUser(
|
||||
chat_id=peer.chat_id,
|
||||
user_id=types.InputPeerSelf()
|
||||
)
|
||||
)
|
||||
|
||||
if delete:
|
||||
self.send(
|
||||
functions.messages.DeleteHistory(
|
||||
peer=peer,
|
||||
max_id=0
|
||||
)
|
||||
)
|
||||
|
||||
return r
|
||||
|
|
|
|||
Loading…
Reference in a new issue