deleteMessages#

Returns: bool

class aiogram.methods.delete_messages.DeleteMessages(*, chat_id: int | str, message_ids: List[int], **extra_data: Any)[source]#

Use this method to delete multiple messages simultaneously. If some of the specified messages can’t be found, they are skipped. Returns True on success.

Source: https://core.telegram.org/bots/api#deletemessages

chat_id: int | str#

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_post_init(_ModelMetaclass__context: Any) None#

We need to both initialize private attributes and call the user-defined model_post_init method.

message_ids: List[int]#

A JSON-serialized list of 1-100 identifiers of messages to delete. See aiogram.methods.delete_message.DeleteMessage for limitations on which messages can be deleted

Usage#

As bot method#

result: bool = await bot.delete_messages(...)

Method as object#

Imports:

  • from aiogram.methods.delete_messages import DeleteMessages

  • alias: from aiogram.methods import DeleteMessages

With specific bot#

result: bool = await bot(DeleteMessages(...))

As reply into Webhook in handler#

return DeleteMessages(...)