mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 01:16:35 +03:00
Let get_input_peer do its magic
parent
227f30333a
commit
aebe48527c
|
@ -3,9 +3,6 @@ For some reason, [`ForwardMessageRequest`](https://lonamiwebs.github.io/Telethon
|
|||
You should use [`ForwardMessagesRequest`](https://lonamiwebs.github.io/Telethon/methods/messages/forward_messages.html) (note it's _Message**s**_, plural) as follows:
|
||||
|
||||
```python
|
||||
from telethon.utils import generate_random_long
|
||||
from telethon.helpers import get_input_peer
|
||||
|
||||
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.
|
||||
|
@ -13,8 +10,7 @@ to_entity = baz() # Who you want to forward them to.
|
|||
client.invoke(ForwardMessagesRequest(
|
||||
from_peer=get_input_peer(from_entity),
|
||||
id=[msg.id for msg in messages],
|
||||
random_id=[generate_random_long() for _ in range(len(messages))],
|
||||
to_peer=get_input_peer(to_entity)
|
||||
to_peer=to_entity
|
||||
))
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user