MaybeInaccessibleMessage¶
- class telegram.MaybeInaccessibleMessage(chat, message_id, date, *, api_kwargs=None)[source]¶
Bases:
telegram.TelegramObjectBase class for Telegram Message Objects.
Currently, that includes
telegram.Messageandtelegram.InaccessibleMessage.Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their
message_idandchatare equalNew 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.datetimeThe default timezone of the bot is used for localization, which is UTC unless
telegram.ext.Defaults.tzinfois 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.datetimeThe default timezone of the bot is used for localization, which is UTC unless
telegram.ext.Defaults.tzinfois used.- Type:
datetime.datetime
- __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_messagewasNone. Note that this does not help with check likeif message.pinned_message is None: ...
for cases where
message.pinned_messageis now no longerNone.Tip
Since objects that can only be of type
MessageorNoneare 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.