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 and new_chat_member are equal.

Added in version 13.4.

Note

In Python from is a reserved word. Use from_user instead.

Examples

Chat Member Bot

Parameters:
chat[source]

Chat the user belongs to.

Type:

telegram.Chat

from_user[source]

Performer of the action, which resulted in the change.

Type:

telegram.User

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:

datetime.datetime

old_chat_member[source]

Previous information about the chat member.

Type:

telegram.ChatMember

new_chat_member[source]

New information about the chat member.

Type:

telegram.ChatMember

Optional. Chat invite link, which was used by the user to join the chat. For joining by invite link events only.

Type:

telegram.ChatInviteLink

Optional. True, if the user joined the chat via a chat folder invite link

Added in version 20.3.

Type:

bool

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 administrator

Added in version 21.2.

Type:

bool

classmethod de_json(data, bot)[source]

See telegram.TelegramObject.de_json().

difference()[source]

Computes the difference between old_chat_member and new_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.

Returns:

A dictionary mapping attribute names to tuples of the form (old_value, new_value)

Return type:

Dict[str, Tuple[object, object]]