InitHistoryImportRequest
Only users can use this request. See code examples.
---functions--- messages.initHistoryImport#34090c3b peer:InputPeer file:InputFile media_count:int = messages.HistoryImport
Returns
messages.HistoryImport |
This type can only be an instance of:
HistoryImport |
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.). |
file | InputFile | |
media_count | int |
Known RPC errors
This request can cause 4 known errors:
ImportFileInvalidError | The file is too large to be imported. |
ImportFormatUnrecognizedError | Unknown import format. |
PreviousChatImportActiveWaitMinError | Similar to a flood wait, must wait {minutes} minutes. |
TimeoutError | A timeout occurred while fetching data from the worker. |
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.InitHistoryImportRequest( peer='username', file=client.upload_file('/path/to/file.jpg'), media_count=42 )) print(result.stringify())