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 (int | List of int) – 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.

  • schedule_date (int, optional) – Date when the message will be automatically sent. Unix time.

Returns

Message | List of Message – 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])