mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 09:26:37 +03:00
Let delete_dialog work for bot accounts without erroring
This commit is contained in:
parent
0bf4c4ae75
commit
5c72e1286e
|
@ -401,6 +401,10 @@ class DialogMethods:
|
||||||
"""
|
"""
|
||||||
Deletes a dialog (leaves a chat or channel).
|
Deletes a dialog (leaves a chat or channel).
|
||||||
|
|
||||||
|
This method can be used as a user and as a bot. However,
|
||||||
|
bots will only be able to use it to leave groups and channels
|
||||||
|
(trying to delete a private conversation will do nothing).
|
||||||
|
|
||||||
See also `Dialog.delete() <telethon.tl.custom.dialog.Dialog.delete>`.
|
See also `Dialog.delete() <telethon.tl.custom.dialog.Dialog.delete>`.
|
||||||
|
|
||||||
Arguments
|
Arguments
|
||||||
|
@ -414,6 +418,9 @@ class DialogMethods:
|
||||||
the other peer too. By default, it's `False`. Set
|
the other peer too. By default, it's `False`. Set
|
||||||
it to `True` to delete the history for both.
|
it to `True` to delete the history for both.
|
||||||
|
|
||||||
|
This makes no difference for bot accounts, who can
|
||||||
|
only leave groups and channels.
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
The :tl:`Updates` object that the request produces,
|
The :tl:`Updates` object that the request produces,
|
||||||
or nothing for private conversations.
|
or nothing for private conversations.
|
||||||
|
@ -438,7 +445,9 @@ class DialogMethods:
|
||||||
else:
|
else:
|
||||||
result = None
|
result = None
|
||||||
|
|
||||||
|
if not await self.is_bot():
|
||||||
await self(functions.messages.DeleteHistoryRequest(entity, 0, revoke=revoke))
|
await self(functions.messages.DeleteHistoryRequest(entity, 0, revoke=revoke))
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def conversation(
|
def conversation(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user