-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Forwarding messages
Lonami edited this page Sep 11, 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:
from telethon.tl.functions.messages import ForwardMessagesRequest
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.