Skip to content

Forwarding messages

Lonami edited this page Jul 9, 2017 · 9 revisions

For some reason, ForwardMessageRequest (note it's Message, singular) does not seem to work.

You should use ForwardMessagesRequest (note it's Messages, plural) as follows:

messages = foo()  # Logic to retrieve a few messages.
from_entity = bar()  # Who has the original messages.
to_entity = baz()  # Who you want to forward them to.

client(ForwardMessagesRequest(
    from_peer=from_entity,
    id=[msg.id for msg in messages],
    to_peer=to_entity
))

The named arguments are there for clarity, although they're not needed because they appear in order. You can obviously just wrap a single message on the list too, if that's all you have.