Make more emphasis on using ForwardMessagesRequest

Lonami 2017-10-02 09:48:11 +02:00
parent e89da06eb8
commit 74b209cb40

@ -1,18 +1,19 @@
For some reason, [`ForwardMessageRequest`](https://lonamiwebs.github.io/Telethon/methods/messages/forward_message.html) (note it's *Message*, singular) does **not** seem to work. Note that [`ForwardMessageRequest`](https://lonamiwebs.github.io/Telethon/methods/messages/forward_message.html) (note it's *Message*, singular) will **not** work if channels are involved. This is because channel (and megagroups) IDs are not unique, so you also need to know who the sender is (a parameter this request doesn't have).
You should use [`ForwardMessagesRequest`](https://lonamiwebs.github.io/Telethon/methods/messages/forward_messages.html) (note it's _Message**s**_, plural) as follows: Either way, you are encouraged to use [`ForwardMessagesRequest`](https://lonamiwebs.github.io/Telethon/methods/messages/forward_messages.html) (note it's _Message**s**_, plural) **always**, since it is more powerful, as follows:
```python ```python
from telethon.tl.functions.messages import ForwardMessagesRequest from telethon.tl.functions.messages import ForwardMessagesRequest
# note the s ^
messages = foo() # Logic to retrieve a few messages. messages = foo() # Logic to retrieve a few messages.
from_entity = bar() # Who has the original messages. from_entity = bar() # Who has the original messages.
to_entity = baz() # Who you want to forward them to. to_entity = baz() # Who you want to forward them to.
client(ForwardMessagesRequest( client(ForwardMessagesRequest(
from_peer=from_entity, from_peer=from_entity, # who sent these messages?
id=[msg.id for msg in messages], id=[msg.id for msg in messages], # which are the messages?
to_peer=to_entity to_peer=to_entity # who are we forwarding them to?
)) ))
``` ```