SendMultiMediaRequest

Both users and bots can use this method. See code examples.

---functions---
messages.sendMultiMedia#b6f11a1c flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true peer:InputPeer reply_to_msg_id:flags.0?int top_msg_id:flags.9?int multi_media:Vector<InputSingleMedia> schedule_date:flags.10?date send_as:flags.13?InputPeer = Updates

Returns

Updates

This type can be an instance of either:

UpdateShortUpdateShortChatMessage
UpdateShortMessageUpdateShortSentMessage
UpdatesUpdatesCombined
UpdatesTooLong

Parameters

peerInputPeerAnything entity-like will work if the library can find its Input version (e.g., usernames, Peer, User or Channel objects, etc.).
multi_mediaInputSingleMediaA list must be supplied.
silentflagThis argument defaults to None and can be omitted.
backgroundflagThis argument defaults to None and can be omitted.
clear_draftflagThis argument defaults to None and can be omitted.
noforwardsflagThis argument defaults to None and can be omitted.
update_stickersets_orderflagThis argument defaults to None and can be omitted.
reply_to_msg_idintThis argument defaults to None and can be omitted.
top_msg_idintThis argument defaults to None and can be omitted.
schedule_datedateThis argument defaults to None and can be omitted.
send_asInputPeerThis argument defaults to None and can be omitted. Anything entity-like will work if the library can find its Input version (e.g., usernames, Peer, User or Channel objects, etc.).

Known RPC errors

This request can cause 3 known errors:

MultiMediaTooLongErrorToo many media files were included in the same album.
ScheduleDateTooLateErrorThe date you tried to schedule is too far in the future (last known limit of 1 year and a few hours).
ScheduleTooMuchErrorYou cannot schedule more messages in this chat (last known limit of 100 per chat).

You can import these from telethon.errors.

Example

Please refer to the documentation of client.send_file() to learn about the parameters and see several code examples on how to use it.

The method above is the recommended way to do it. If you need more control over the parameters or want to learn how it is implemented, open the details by clicking on the "Details" text.

from telethon.sync import TelegramClient
from telethon import functions, types

with TelegramClient(name, api_id, api_hash) as client:
    result = client(functions.messages.SendMultiMediaRequest(
        peer='username',
        multi_media=[types.InputSingleMedia(
            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
            ),
            message='Hello there!'
        )],
        noforwards=True,
        update_stickersets_order=True,
        top_msg_id=42,
        schedule_date=datetime.datetime(2018, 6, 25),
        send_as='username'
    ))
    print(result.stringify())