SaveDraftRequest
Only users can use this request. See code examples.
---functions--- messages.saveDraft#d372c5ce flags:# no_webpage:flags.1?true invert_media:flags.6?true reply_to:flags.4?InputReplyTo peer:InputPeer message:string entities:flags.3?Vector<MessageEntity> media:flags.5?InputMedia effect:flags.7?long = Bool
Returns
Bool |
This type has no instances available.
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.). |
message | string | |
no_webpage | flag | This argument defaults to None and can be omitted. |
invert_media | flag | This argument defaults to None and can be omitted. |
reply_to | InputReplyTo | This argument defaults to None and can be omitted. |
entities | MessageEntity | This argument defaults to None and can be omitted. Otherwise, a list must be supplied. |
media | InputMedia | This argument defaults to None and can be omitted. |
effect | long | This argument defaults to None and can be omitted. |
Known RPC errors
This request can cause 2 known errors:
EntityBoundsInvalidError | Some of provided entities have invalid bounds (length is zero or out of the boundaries of the string). |
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.SaveDraftRequest( peer='username', message='Hello there!', no_webpage=True, invert_media=True, reply_to=types.InputReplyToMessage( reply_to_msg_id=42, top_msg_id=42, reply_to_peer_id='username', quote_text='some string here', quote_entities=[types.MessageEntityUnknown( offset=42, length=42 )], quote_offset=42 ), media=types.InputMediaUploadedPhoto( file=client.upload_file('/path/to/file.jpg'), spoiler=True, stickers=[types.InputDocument( id=-12398745604826, access_hash=-12398745604826, file_reference=b'arbitrary\x7f data \xfa here' )], ttl_seconds=42 ), effect=-12398745604826 )) print(result)