TranslateRichMessageRequest

Both users and bots may be able to use this request. See code examples.

---functions---
messages.translateRichMessage#1a542004 flags:# peer:flags.0?InputPeer id:flags.0?Vector<int> text:flags.1?Vector<InputRichMessage> to_lang:string tone:flags.2?string = messages.TranslatedRichMessage

Returns

messages.TranslatedRichMessage

This type can only be an instance of:

TranslatedRichMessage

Parameters

to_langstring
peerInputPeerThis 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.).
idintThis argument defaults to None and can be omitted. Otherwise, a list must be supplied.
textInputRichMessageThis argument defaults to None and can be omitted. Otherwise, a list must be supplied.
tonestringThis argument defaults to None and can be omitted.

Known RPC errors

This request can't cause any RPC error as far as we know.

Example

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

with TelegramClient(name, api_id, api_hash) as client:
    result = client(functions.messages.TranslateRichMessageRequest(
        to_lang='some string here',
        peer='username',
        id=[42],
        text=[types.InputRichMessage(
            blocks=[types.PageBlockUnsupported()],
            rtl=True,
            noautolink=True,
            photos=[types.InputPhoto(
                id=-12398745604826,
                access_hash=-12398745604826,
                file_reference=b'arbitrary\x7f data \xfa here'
            )],
            documents=[types.InputDocument(
                id=-12398745604826,
                access_hash=-12398745604826,
                file_reference=b'arbitrary\x7f data \xfa here'
            )],
            users=['username']
        )],
        tone='some string here'
    ))
    print(result.stringify())