Skip to content
Back to top
View this page

# MaybeInaccessibleMessage

class telegram.MaybeInaccessibleMessage(chat, message_id, date, *, api_kwargs=None)

  Bases: `telegram.TelegramObject`

  Base class for Telegram Message Objects.

  Currently, that includes `telegram.Message` and `telegram.InaccessibleMessage`.

  Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their `message_id` and `chat` are equal

  Available In

  - `telegram.CallbackQuery.message`

  - `telegram.Message.pinned_message`

  - `telegram.PollOptionAdded.poll_message`

  - `telegram.PollOptionDeleted.poll_message`

  Changed in version 21.0: `__bool__` is no longer overriden and defaults to Pythons standard implementation.

  Added in version 20.8.

  Parameters:

    - message_id (`int`) – Unique message identifier.

    - date (`datetime.datetime`) –

      Date the message was sent in Unix time or 0 in Unix time. Converted to `datetime.datetime`

      The default timezone of the bot is used for localization, which is UTC unless `telegram.ext.Defaults.tzinfo` is used.

    - chat (`telegram.Chat`) – Conversation the message belongs to.

  message_id

    Unique message identifier.

    Type:

      `int`

  date

    Date the message was sent in Unix time or 0 in Unix time. Converted to `datetime.datetime`

    The default timezone of the bot is used for localization, which is UTC unless `telegram.ext.Defaults.tzinfo` is used.

    Type:

      `datetime.datetime`

  chat

    Conversation the message belongs to.

    Type:

      `telegram.Chat`

  property is_accessible

    Convenience attribute. `True`, if the date is not 0 in Unix time.

    Added in version 20.8.