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

Method delete_messages

src/telegram/_bot.py:1283–1320  ·  view source on GitHub ↗

Use this method to delete multiple messages simultaneously. If some of the specified messages can't be found, they are skipped. .. versionadded:: 20.8 Args: chat_id (:obj:`int` | :obj:`str`): |chat_id_channel| message_ids (Sequence[:obj:`int

(
        self,
        chat_id: int | str,
        message_ids: Sequence[int],
        *,
        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

1281 )
1282
1283 async def delete_messages(
1284 self,
1285 chat_id: int | str,
1286 message_ids: Sequence[int],
1287 *,
1288 read_timeout: ODVInput[float] = DEFAULT_NONE,
1289 write_timeout: ODVInput[float] = DEFAULT_NONE,
1290 connect_timeout: ODVInput[float] = DEFAULT_NONE,
1291 pool_timeout: ODVInput[float] = DEFAULT_NONE,
1292 api_kwargs: JSONDict | None = None,
1293 ) -> bool:
1294 """
1295 Use this method to delete multiple messages simultaneously. If some of the specified
1296 messages can't be found, they are skipped.
1297
1298 .. versionadded:: 20.8
1299
1300 Args:
1301 chat_id (:obj:`int` | :obj:`str`): |chat_id_channel|
1302 message_ids (Sequence[:obj:`int`]): A list of
1303 :tg-const:`telegram.constants.BulkRequestLimit.MIN_LIMIT`-
1304 :tg-const:`telegram.constants.BulkRequestLimit.MAX_LIMIT` identifiers of messages
1305 to delete. See :meth:`delete_message` for limitations on which messages can be
1306 deleted.
1307
1308 Returns:
1309 :obj:`bool`: On success, :obj:`True` is returned.
1310 """
1311 data: JSONDict = {"chat_id": chat_id, "message_ids": message_ids}
1312 return await self._post(
1313 "deleteMessages",
1314 data,
1315 read_timeout=read_timeout,
1316 write_timeout=write_timeout,
1317 connect_timeout=connect_timeout,
1318 pool_timeout=pool_timeout,
1319 api_kwargs=api_kwargs,
1320 )
1321
1322 async def forward_message(
1323 self,

Callers 3

test_delete_messagesMethod · 0.45
test_delete_messagesMethod · 0.45
test_delete_messagesMethod · 0.45

Calls 1

_postMethod · 0.95

Tested by 3

test_delete_messagesMethod · 0.36
test_delete_messagesMethod · 0.36
test_delete_messagesMethod · 0.36