forward_messages()¶
-
Client.forward_messages()¶ Forward messages of any kind.
- Parameters
chat_id (
int|str) – Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use “me” or “self”. For a contact that exists in your Telegram address book you can use his phone number (str).from_chat_id (
int|str) – Unique identifier (int) or username (str) of the source chat where the original message was sent. For your personal cloud (Saved Messages) you can simply use “me” or “self”. For a contact that exists in your Telegram address book you can use his phone number (str).message_ids (
iterable) – A list of Message identifiers in the chat specified in from_chat_id or a single message id. Iterators and Generators are also accepted.disable_notification (
bool, optional) – Sends the message silently. Users will receive a notification with no sound.as_copy (
bool, optional) – Pass True to forward messages without the forward header (i.e.: send a copy of the message content so that it appears as originally sent by you). Defaults to False.remove_caption (
bool, optional) – If set to True and as_copy is enabled as well, media captions are not preserved when copying the message. Has no effect if as_copy is not enabled. Defaults to False.schedule_date (
int, optional) – Date when the message will be automatically sent. Unix time.
- Returns
Message| List ofMessage– In case message_ids was an integer, the single forwarded message is returned, otherwise, in case message_ids was an iterable, the returned value will be a list of messages, even if such iterable contained just a single element.
Example
# Forward a single message app.forward_messages("me", "pyrogram", 20) # Forward multiple messages at once app.forward_messages("me", "pyrogram", [3, 20, 27]) # Forward messages as copy app.forward_messages("me", "pyrogram", 20, as_copy=True)