raito.utils.errors module

class raito.utils.errors.SuppressNotModifiedError(ignore_message='Bad Request: message is not modified')[исходный код]

Базовые классы: object

Context manager that suppresses the TelegramBadRequest exception with the message Bad Request: message is not modified.

This is useful when editing a Telegram message and the new content is identical to the existing one, which would otherwise raise an error from the Telegram API.

Пример

from raito.utils.errors import SuppressNotModifiedError

with SuppressNotModifiedError():
    await message.edit_text("same text")
Параметры:

ignore_message (str) – The exact error message to match. If this message is found in the raised TelegramBadRequest, the exception is suppressed. Defaults to "Bad Request: message is not modified".