ChatMemberUpdated¶
- class telegram.ChatMemberUpdated(chat, from_user, date, old_chat_member, new_chat_member, invite_link=None, via_chat_folder_invite_link=None, via_join_request=None, *, api_kwargs=None)[source]¶
Bases:
telegram.TelegramObject
This object represents changes in the status of a chat member.
Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their
chat
,from_user
,date
,old_chat_member
andnew_chat_member
are equal.Added in version 13.4.
Examples
- Parameters:
chat (
telegram.Chat
) – Chat the user belongs to.from_user (
telegram.User
) – Performer of the action, which resulted in the change.Date the change was done in Unix time. Converted to
datetime.datetime
.Changed in version 20.3: The default timezone of the bot is used for localization, which is UTC unless
telegram.ext.Defaults.tzinfo
is used.old_chat_member (
telegram.ChatMember
) – Previous information about the chat member.new_chat_member (
telegram.ChatMember
) – New information about the chat member.invite_link (
telegram.ChatInviteLink
, optional) – Chat invite link, which was used by the user to join the chat. For joining by invite link events only.via_chat_folder_invite_link (
bool
, optional) –True
, if the user joined the chat via a chat folder invite linkAdded in version 20.3.
via_join_request (
bool
, optional) –True
, if the user joined the chat after sending a direct join request without using an invite link and being approved by an administratorAdded in version 21.2.
- date[source]¶
Date the change was done in Unix time. Converted to
datetime.datetime
.Changed in version 20.3: The default timezone of the bot is used for localization, which is UTC unless
telegram.ext.Defaults.tzinfo
is used.- Type:
- invite_link[source]¶
Optional. Chat invite link, which was used by the user to join the chat. For joining by invite link events only.
- Type:
- via_chat_folder_invite_link[source]¶
Optional.
True
, if the user joined the chat via a chat folder invite linkAdded in version 20.3.
- Type:
- via_join_request[source]¶
Optional.
True
, if the user joined the chat after sending a direct join request without using an invite link and being approved by an administratorAdded in version 21.2.
- Type:
- difference()[source]¶
Computes the difference between
old_chat_member
andnew_chat_member
.Example
>>> chat_member_updated.difference() {'custom_title': ('old title', 'new title')}
Note
To determine, if the
telegram.ChatMember.user
attribute has changed, every attribute of the user will be checked.Added in version 13.5.