DeleteHistoryRequest
Only users can use this request. See code examples.
---functions--- messages.deleteHistory#b08f922a flags:# just_clear:flags.0?true revoke:flags.1?true peer:InputPeer max_id:int min_date:flags.2?date max_date:flags.3?date = messages.AffectedHistory
Returns
| messages.AffectedHistory |
This type can only be an instance of:
| AffectedHistory |
Parameters
| peer | InputPeer | Anything entity-like will work if the library can find its Input version (e.g., usernames, Peer, User or Channel objects, etc.). |
| max_id | int | |
| just_clear | flag | This argument defaults to None and can be omitted. |
| revoke | flag | This argument defaults to None and can be omitted. |
| min_date | date | This argument defaults to None and can be omitted. |
| max_date | date | This argument defaults to None and can be omitted. |
Known RPC errors
This request can cause 1 known error:
PeerIdInvalidError | An invalid Peer was used. Make sure to pass the right peer type and that the value is valid (for instance, bots cannot start conversations). |
You can import these from telethon.errors.
Example
from telethon.sync import TelegramClient
from telethon import functions, types
with TelegramClient(name, api_id, api_hash) as client:
result = client(functions.messages.DeleteHistoryRequest(
peer='username',
max_id=0,
just_clear=True,
revoke=True,
min_date=datetime.datetime(2018, 6, 25),
max_date=datetime.datetime(2018, 6, 25)
))
print(result.stringify())