forward_messages()#
- Client.forward_messages()#
Forward messages of any kind.
Usable by ✅ Users ✅ Bots- 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
| Iterable ofint
) – An iterable of message identifiers in the chat specified in from_chat_id or a single message id.message_thread_id (
int
, optional) – Unique identifier for the target message thread (topic) of the forum; for forum supergroups onlydisable_notification (
bool
, optional) – Sends the message silently. Users will receive a notification with no sound.protect_content (
bool
, optional) – Pass True if the content of the message must be protected from forwarding and saving; for bots only.allow_paid_broadcast (
bool
, optional) – Pass True to allow the message to ignore regular broadcast limits for a fee; for bots onlysend_copy (
bool
, optional) – Pass True to copy content of the messages without reference to the original sender.remove_caption (
bool
, optional) – Pass True to remove media captions of message copies.new_video_start_timestamp (
int
, optional) – The new video start timestamp. Pass time to replace video start timestamp in the forwarded message.send_as (
int
|str
) – Unique identifier (int) or username (str) of the chat or channel to send the message as. You can use this to send the message on behalf of a chat or channel where you have appropriate permissions. Use theget_send_as_chats()
to return the list of message sender identifiers, which can be used to send messages in the chat, This setting applies to the current message and will remain effective for future messages unless explicitly changed. To set this behavior permanently for all messages, useset_send_as_chat()
.schedule_date (
datetime
, optional) – Date when the message will be automatically sent.
- Returns:
Message
| List ofMessage
– In case message_ids was not a list, a single message is returned, otherwise a list of messages is returned.
Example
# Forward a single message await app.forward_messages(to_chat, from_chat, 123) # Forward multiple messages at once await app.forward_messages(to_chat, from_chat, [1, 2, 3])