MaybeInaccessibleMessage¶
- class telegram.MaybeInaccessibleMessage(chat, message_id, date, *, api_kwargs=None)[source]¶
Bases:
telegram.TelegramObject
Base class for Telegram Message Objects.
Currently, that includes
telegram.Message
andtelegram.InaccessibleMessage
.Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their
message_id
andchat
are equalNew in version 20.8.
- Parameters:
message_id (
int
) – Unique message identifier.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.
- date[source]¶
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:
- __bool__()[source]¶
Overrides
object.__bool__()
to return the value ofis_accessible
. This is intended to ease migration to Bot API 7.0, as this allows checks likeif message.pinned_message: ...
to work as before, when
message.pinned_message
wasNone
. Note that this does not help with check likeif message.pinned_message is None: ...
for cases where
message.pinned_message
is now no longerNone
.Tip
Since objects that can only be of type
Message
orNone
are not affected by this change,Message.__bool__()
is not overridden and will continue to work as before.New in version 20.8.
Deprecated since version 20.8: This behavior is introduced only temporarily to ease migration to Bot API 7.0. It will be removed along with other functionality deprecated by Bot API 7.0.