Handle PeerIdInvalidError in delete_dialog

This commit is contained in:
Lonami Exo
2020-01-07 12:13:42 +01:00
parent 582a61192a
commit d68d70362b
2 changed files with 19 additions and 5 deletions

View File

@@ -112,7 +112,10 @@ class Dialog:
Shorthand for `telethon.client.dialogs.DialogMethods.delete_dialog`
with ``entity`` already set.
"""
await self._client.delete_dialog(self.input_entity, revoke=revoke)
# Pass the entire entity so the method can determine whether
# the `Chat` is deactivated (in which case we don't kick ourselves,
# or it would raise `PEER_ID_INVALID`).
await self._client.delete_dialog(self.entity, revoke=revoke)
async def archive(self, folder=1):
"""