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

Method forward_message

src/telegram/_bot.py:1322–1408  ·  view source on GitHub ↗

Use this method to forward messages of any kind. Service messages can't be forwarded. Note: Since the release of Bot API 5.5 it can be impossible to forward messages from some chats. Use the attributes :attr:`telegram.Message.has_protected_content` and

(
        self,
        chat_id: int | str,
        from_chat_id: str | int,
        message_id: int,
        disable_notification: ODVInput[bool] = DEFAULT_NONE,
        protect_content: ODVInput[bool] = DEFAULT_NONE,
        message_thread_id: int | 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,
        *,
        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

1320 )
1321
1322 async def forward_message(
1323 self,
1324 chat_id: int | str,
1325 from_chat_id: str | int,
1326 message_id: int,
1327 disable_notification: ODVInput[bool] = DEFAULT_NONE,
1328 protect_content: ODVInput[bool] = DEFAULT_NONE,
1329 message_thread_id: int | None = None,
1330 video_start_timestamp: int | None = None,
1331 direct_messages_topic_id: int | None = None,
1332 suggested_post_parameters: "SuggestedPostParameters | None" = None,
1333 message_effect_id: str | None = None,
1334 *,
1335 read_timeout: ODVInput[float] = DEFAULT_NONE,
1336 write_timeout: ODVInput[float] = DEFAULT_NONE,
1337 connect_timeout: ODVInput[float] = DEFAULT_NONE,
1338 pool_timeout: ODVInput[float] = DEFAULT_NONE,
1339 api_kwargs: JSONDict | None = None,
1340 ) -> Message:
1341 """
1342 Use this method to forward messages of any kind. Service messages can't be forwarded.
1343
1344 Note:
1345 Since the release of Bot API 5.5 it can be impossible to forward messages from
1346 some chats. Use the attributes :attr:`telegram.Message.has_protected_content` and
1347 :attr:`telegram.ChatFullInfo.has_protected_content` to check this.
1348
1349 As a workaround, it is still possible to use :meth:`copy_message`. However, this
1350 behaviour is undocumented and might be changed by Telegram.
1351
1352 Args:
1353 chat_id (:obj:`int` | :obj:`str`): |chat_id_channel|
1354 from_chat_id (:obj:`int` | :obj:`str`): Unique identifier for the chat where the
1355 original message was sent (or channel username in the format ``@channelusername``).
1356 message_id (:obj:`int`): Message identifier in the chat specified in
1357 :paramref:`from_chat_id`.
1358 video_start_timestamp (:obj:`int`, optional): New start timestamp for the
1359 forwarded video in the message
1360
1361 .. versionadded:: 21.11
1362 disable_notification (:obj:`bool`, optional): |disable_notification|
1363 protect_content (:obj:`bool`, optional): |protect_content|
1364
1365 .. versionadded:: 13.10
1366 message_thread_id (:obj:`int`, optional): |message_thread_id_arg|
1367
1368 .. versionadded:: 20.0
1369 suggested_post_parameters (:class:`telegram.SuggestedPostParameters`, optional): An
1370 object containing the parameters of the suggested post to send; for direct messages
1371 chats only.
1372
1373 .. versionadded:: 22.4
1374 direct_messages_topic_id (:obj:`int`, optional): Identifier of the direct messages
1375 topic to which the message will be forwarded; required if the message is
1376 forwarded to a direct messages chat.
1377
1378 .. versionadded:: 22.4
1379 message_effect_id (:obj:`str`, optional): Unique identifier of the message effect to be

Callers 7

forwardMethod · 0.45
forward_fromMethod · 0.45
forward_toMethod · 0.45
forward_fromMethod · 0.45
forward_toMethod · 0.45
test_forward_messageMethod · 0.45
video_quality_listFunction · 0.45

Calls 1

_send_messageMethod · 0.95

Tested by 2

test_forward_messageMethod · 0.36
video_quality_listFunction · 0.36