copy_messages()

async Client.copy_messages()

Copy messages of any kind in bulk without a forward link.

If some messages can’t be copied they are skipped. This method is analogous to forward_messages() but the copied messages have no link to the original.

Usable by Users Bots
Parameters:
  • chat_id (int | str) – Unique identifier (int) or username (str) of the target chat.

  • from_chat_id (int | str) – Unique identifier (int) or username (str) of the source chat.

  • message_ids (int | Iterable of int) – Message identifiers in the source chat. Pass a single int or a list of ints.

  • message_thread_id (int, optional) – Unique identifier for the target message thread (topic) of the forum. For supergroups only.

  • direct_messages_topic_id (int, optional) – Unique identifier of the direct messages topic to copy into.

  • disable_notification (bool, optional) – Sends the messages silently. Users will receive a notification with no sound.

  • protect_content (bool, optional) – Protects the contents of the sent messages from forwarding and saving.

  • remove_caption (bool, optional) – Pass True to copy messages without their captions.

  • reply_markup (InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply, optional) – Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. If not specified, the original reply markup is kept. Pass None to remove the reply markup.

Returns:

List of Message – A list of the copied messages.

Example

# Copy a single message
await app.copy_messages(to_chat, from_chat, 123)

# Copy multiple messages at once
await app.copy_messages(to_chat, from_chat, [1, 2, 3])