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

Method delete

src/telegram/_message.py:4883–4937  ·  view source on GitHub ↗

Shortcut for either:: await bot.delete_message( chat_id=message.chat_id, message_id=message.message_id, *args, **kwargs ) or:: await bot.delete_business_messages( business_connection_id=self.business_connection_

(
        self,
        *,
        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

4881 )
4882
4883 async def delete(
4884 self,
4885 *,
4886 read_timeout: ODVInput[float] = DEFAULT_NONE,
4887 write_timeout: ODVInput[float] = DEFAULT_NONE,
4888 connect_timeout: ODVInput[float] = DEFAULT_NONE,
4889 pool_timeout: ODVInput[float] = DEFAULT_NONE,
4890 api_kwargs: JSONDict | None = None,
4891 ) -> bool:
4892 """Shortcut for either::
4893
4894 await bot.delete_message(
4895 chat_id=message.chat_id, message_id=message.message_id, *args, **kwargs
4896 )
4897
4898 or::
4899
4900 await bot.delete_business_messages(
4901 business_connection_id=self.business_connection_id,
4902 message_ids=[self.message_id],
4903 *args,
4904 **kwargs,
4905 )
4906
4907 For the documentation of the arguments, please see
4908 :meth:`telegram.Bot.delete_message` and :meth:`telegram.Bot.delete_business_messages`.
4909
4910 .. versionchanged:: 22.4
4911 Calls either :meth:`telegram.Bot.delete_message`
4912 or :meth:`telegram.Bot.delete_business_messages` based
4913 on :attr:`business_connection_id`.
4914
4915 Returns:
4916 :obj:`bool`: On success, :obj:`True` is returned.
4917
4918 """
4919 if self.business_connection_id:
4920 return await self.get_bot().delete_business_messages(
4921 business_connection_id=self.business_connection_id,
4922 message_ids=[self.message_id],
4923 read_timeout=read_timeout,
4924 write_timeout=write_timeout,
4925 connect_timeout=connect_timeout,
4926 pool_timeout=pool_timeout,
4927 api_kwargs=api_kwargs,
4928 )
4929 return await self.get_bot().delete_message(
4930 chat_id=self.chat_id,
4931 message_id=self.message_id,
4932 read_timeout=read_timeout,
4933 write_timeout=write_timeout,
4934 connect_timeout=connect_timeout,
4935 pool_timeout=pool_timeout,
4936 api_kwargs=api_kwargs,
4937 )
4938
4939 async def stop_poll(
4940 self,

Calls 3

get_botMethod · 0.80
delete_messageMethod · 0.45