telegram.ChatMemberUpdated

class telegram.ChatMemberUpdated(chat, from_user, date, old_chat_member, new_chat_member, invite_link=None, **_kwargs)

Bases: telegram.base.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.

New in version 13.4.

Note

In Python from is a reserved word, use from_user instead.

Parameters
  • chat (telegram.Chat) – Chat the user belongs to.

  • from_user (telegram.User) – Performer of the action, which resulted in the change.

  • date (datetime.datetime) – Date the change was done in Unix time. Converted to datetime.datetime.

  • 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.

chat

Chat the user belongs to.

Type

telegram.Chat

from_user

Performer of the action, which resulted in the change.

Type

telegram.User

date

Date the change was done in Unix time. Converted to datetime.datetime.

Type

datetime.datetime

old_chat_member

Previous information about the chat member.

Type

telegram.ChatMember

new_chat_member

New information about the chat member.

Type

telegram.ChatMember

Optional. Chat invite link, which was used by the user to join the chat.

Type

telegram.ChatInviteLink

difference()

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.

New in version 13.5.

Returns

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

Return type

Dict[str, Tuple[obj, obj]]