mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-07 13:34:59 +03:00
Factor out DeleteHistoryRequest
This commit is contained in:
parent
ed09a1377e
commit
e263613879
|
@ -98,13 +98,14 @@ class Dialog:
|
||||||
|
|
||||||
async def delete(self):
|
async def delete(self):
|
||||||
if self.is_channel:
|
if self.is_channel:
|
||||||
await self._client(functions.channels.LeaveChannelRequest(self.input_entity))
|
await self._client(functions.channels.LeaveChannelRequest(
|
||||||
elif self.is_group:
|
self.input_entity))
|
||||||
await self._client(functions.messages.DeleteChatUserRequest(self.entity.id,
|
|
||||||
types.InputPeerSelf()))
|
|
||||||
await self._client(functions.messages.DeleteHistoryRequest(self.input_entity, 0, just_clear=False))
|
|
||||||
else:
|
else:
|
||||||
await self._client(functions.messages.DeleteHistoryRequest(self.input_entity, 0))
|
if self.is_group:
|
||||||
|
await self._client(functions.messages.DeleteChatUserRequest(
|
||||||
|
self.entity.id, types.InputPeerSelf()))
|
||||||
|
await self._client(functions.messages.DeleteHistoryRequest(
|
||||||
|
self.input_entity, 0))
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user