Factor out DeleteHistoryRequest

This commit is contained in:
Lonami 2018-09-28 15:46:19 +02:00 committed by GitHub
parent ed09a1377e
commit e263613879
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -98,13 +98,14 @@ class Dialog:
async def delete(self):
if self.is_channel:
await self._client(functions.channels.LeaveChannelRequest(self.input_entity))
elif self.is_group:
await self._client(functions.messages.DeleteChatUserRequest(self.entity.id,
types.InputPeerSelf()))
await self._client(functions.messages.DeleteHistoryRequest(self.input_entity, 0, just_clear=False))
await self._client(functions.channels.LeaveChannelRequest(
self.input_entity))
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):
return {