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

Method forward

src/telegram/_message.py:4146–4202  ·  view source on GitHub ↗

Shortcut for:: await bot.forward_message( from_chat_id=update.effective_message.chat_id, message_id=update.effective_message.message_id, direct_messages_topic_id=self.direct_messages_topic.topic_id, *args,

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

4144 )
4145
4146 async def forward(
4147 self,
4148 chat_id: int | str,
4149 disable_notification: ODVInput[bool] = DEFAULT_NONE,
4150 protect_content: ODVInput[bool] = DEFAULT_NONE,
4151 message_thread_id: int | None = None,
4152 video_start_timestamp: int | None = None,
4153 suggested_post_parameters: "SuggestedPostParameters | None" = None,
4154 message_effect_id: str | None = None,
4155 *,
4156 read_timeout: ODVInput[float] = DEFAULT_NONE,
4157 write_timeout: ODVInput[float] = DEFAULT_NONE,
4158 connect_timeout: ODVInput[float] = DEFAULT_NONE,
4159 pool_timeout: ODVInput[float] = DEFAULT_NONE,
4160 api_kwargs: JSONDict | None = None,
4161 ) -> "Message":
4162 """Shortcut for::
4163
4164 await bot.forward_message(
4165 from_chat_id=update.effective_message.chat_id,
4166 message_id=update.effective_message.message_id,
4167 direct_messages_topic_id=self.direct_messages_topic.topic_id,
4168 *args,
4169 **kwargs
4170 )
4171
4172 For the documentation of the arguments, please see :meth:`telegram.Bot.forward_message`.
4173
4174 Note:
4175 Since the release of Bot API 5.5 it can be impossible to forward messages from
4176 some chats. Use the attributes :attr:`telegram.Message.has_protected_content` and
4177 :attr:`telegram.ChatFullInfo.has_protected_content` to check this.
4178
4179 As a workaround, it is still possible to use :meth:`copy`. However, this
4180 behaviour is undocumented and might be changed by Telegram.
4181
4182 Returns:
4183 :class:`telegram.Message`: On success, instance representing the message forwarded.
4184
4185 """
4186 return await self.get_bot().forward_message(
4187 chat_id=chat_id,
4188 from_chat_id=self.chat_id,
4189 message_id=self.message_id,
4190 video_start_timestamp=video_start_timestamp,
4191 disable_notification=disable_notification,
4192 protect_content=protect_content,
4193 message_thread_id=message_thread_id,
4194 suggested_post_parameters=suggested_post_parameters,
4195 read_timeout=read_timeout,
4196 write_timeout=write_timeout,
4197 connect_timeout=connect_timeout,
4198 pool_timeout=pool_timeout,
4199 api_kwargs=api_kwargs,
4200 direct_messages_topic_id=self._extract_direct_messages_topic_id(),
4201 message_effect_id=message_effect_id,
4202 )
4203

Callers 2

test_forwardMethod · 0.80

Calls 3

get_botMethod · 0.80
forward_messageMethod · 0.45

Tested by 2

test_forwardMethod · 0.64