MCPcopy Index your code
hub / github.com/python-telegram-bot/python-telegram-bot / copy_message

Method copy_message

src/telegram/_bot.py:8239–8393  ·  view source on GitHub ↗

Use this method to copy messages of any kind. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. The method is analogous to the method :meth:`forward_message`, but the copied message doesn't have a link t

(
        self,
        chat_id: int | str,
        from_chat_id: str | int,
        message_id: int,
        caption: str | None = None,
        parse_mode: ODVInput[str] = DEFAULT_NONE,
        caption_entities: Sequence["MessageEntity"] | None = None,
        disable_notification: ODVInput[bool] = DEFAULT_NONE,
        reply_markup: "ReplyMarkup | None" = None,
        protect_content: ODVInput[bool] = DEFAULT_NONE,
        message_thread_id: int | None = None,
        reply_parameters: "ReplyParameters | None" = None,
        show_caption_above_media: bool | None = None,
        allow_paid_broadcast: bool | None = None,
        video_start_timestamp: int | None = None,
        direct_messages_topic_id: int | None = None,
        suggested_post_parameters: "SuggestedPostParameters | None" = None,
        message_effect_id: str | None = None,
        *,
        allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
        reply_to_message_id: int | None = None,
        read_timeout: ODVInput[float] = DEFAULT_NONE,
        write_timeout: ODVInput[float] = DEFAULT_NONE,
        connect_timeout: ODVInput[float] = DEFAULT_NONE,
        pool_timeout: ODVInput[float] = DEFAULT_NONE,
        api_kwargs: JSONDict | None = None,
    )

Source from the content-addressed store, hash-verified

8237 )
8238
8239 async def copy_message(
8240 self,
8241 chat_id: int | str,
8242 from_chat_id: str | int,
8243 message_id: int,
8244 caption: str | None = None,
8245 parse_mode: ODVInput[str] = DEFAULT_NONE,
8246 caption_entities: Sequence["MessageEntity"] | None = None,
8247 disable_notification: ODVInput[bool] = DEFAULT_NONE,
8248 reply_markup: "ReplyMarkup | None" = None,
8249 protect_content: ODVInput[bool] = DEFAULT_NONE,
8250 message_thread_id: int | None = None,
8251 reply_parameters: "ReplyParameters | None" = None,
8252 show_caption_above_media: bool | None = None,
8253 allow_paid_broadcast: bool | None = None,
8254 video_start_timestamp: int | None = None,
8255 direct_messages_topic_id: int | None = None,
8256 suggested_post_parameters: "SuggestedPostParameters | None" = None,
8257 message_effect_id: str | None = None,
8258 *,
8259 allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
8260 reply_to_message_id: int | None = None,
8261 read_timeout: ODVInput[float] = DEFAULT_NONE,
8262 write_timeout: ODVInput[float] = DEFAULT_NONE,
8263 connect_timeout: ODVInput[float] = DEFAULT_NONE,
8264 pool_timeout: ODVInput[float] = DEFAULT_NONE,
8265 api_kwargs: JSONDict | None = None,
8266 ) -> MessageId:
8267 """Use this method to copy messages of any kind. Service messages, paid media messages,
8268 giveaway messages, giveaway winners messages, and invoice messages
8269 can't be copied. The method is analogous to the method :meth:`forward_message`, but the
8270 copied message doesn't have a link to the original message.
8271
8272 Args:
8273 chat_id (:obj:`int` | :obj:`str`): |chat_id_channel|
8274 from_chat_id (:obj:`int` | :obj:`str`): Unique identifier for the chat where the
8275 original message was sent (or channel username in the format ``@channelusername``).
8276 message_id (:obj:`int`): Message identifier in the chat specified in from_chat_id.
8277 video_start_timestamp (:obj:`int`, optional): New start timestamp for the
8278 copied video in the message
8279
8280 .. versionadded:: 21.11
8281 caption (:obj:`str`, optional): New caption for media,
8282 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after
8283 entities parsing. If not specified, the original caption is kept.
8284 parse_mode (:obj:`str`, optional): Mode for parsing entities in the new caption. See
8285 the constants in :class:`telegram.constants.ParseMode` for the available modes.
8286 caption_entities (Sequence[:class:`telegram.MessageEntity`], optional):
8287 |caption_entities|
8288
8289 .. versionchanged:: 20.0
8290 |sequenceargs|
8291 disable_notification (:obj:`bool`, optional): |disable_notification|
8292 protect_content (:obj:`bool`, optional): |protect_content|
8293
8294 .. versionadded:: 13.10
8295 message_thread_id (:obj:`int`, optional): |message_thread_id_arg|
8296

Calls 3

_postMethod · 0.95
ReplyParametersClass · 0.90
de_jsonMethod · 0.45