MessageOrigin

class telegram.MessageOrigin(type, date, *, api_kwargs=None)[source]

Bases: telegram.TelegramObject

Base class for telegram MessageOrigin object, it can be one of:

Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their type and date are equal.

New in version 20.8.

Parameters:
type[source]

Type of the message origin, can be on of: USER, HIDDEN_USER, CHAT, or CHANNEL.

Type:

str

date[source]

Date the message was sent originally. The default timezone of the bot is used for localization, which is UTC unless telegram.ext.Defaults.tzinfo is used.

Type:

datetime.datetime

CHANNEL = 'channel'[source]

telegram.constants.MessageOriginType.CHANNEL

CHAT = 'chat'[source]

telegram.constants.MessageOriginType.CHAT

HIDDEN_USER = 'hidden_user'[source]

telegram.constants.MessageOriginType.HIDDEN_USER

USER = 'user'[source]

telegram.constants.MessageOriginType.USER

classmethod de_json(data, bot)[source]

Converts JSON data to the appropriate MessageOrigin object, i.e. takes care of selecting the correct subclass.