Hide navigation sidebar
Hide table of contents sidebar
PTB has undergone significant changes in v20. Please read the documentation carefully and also check out the transition guide in the wiki.
Back to top
Toggle table of contents sidebar

# ChatMember

class telegram.ChatMember(user, status, *, api_kwargs=None)

  Bases: `telegram.TelegramObject`

  Base class for Telegram ChatMember Objects. Currently, the following 6 types of chat members are supported:

  - `telegram.ChatMemberOwner`

  - `telegram.ChatMemberAdministrator`

  - `telegram.ChatMemberMember`

  - `telegram.ChatMemberRestricted`

  - `telegram.ChatMemberLeft`

  - `telegram.ChatMemberBanned`

  Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their `user` and `status` are equal.

  Examples

  Chat Member Bot

  Available In

  - `telegram.ChatMemberUpdated.new_chat_member`

  - `telegram.ChatMemberUpdated.old_chat_member`

  Returned In

  `telegram.Bot.get_chat_member()`

  Changed in version 20.0:

  - As of Bot API 5.3, `ChatMember` is nothing but the base class for the subclasses listed above and is no longer returned directly by `get_chat()`. Therefore, most of the arguments and attributes were removed and you should no longer use `ChatMember` directly.

  - The constant `ChatMember.CREATOR` was replaced by `OWNER`

  - The constant `ChatMember.KICKED` was replaced by `BANNED`

  Parameters:

    - user (`telegram.User`) – Information about the user.

    - status (`str`) – The member’s status in the chat. Can be `ADMINISTRATOR`, `OWNER`, `BANNED`, `LEFT`, `MEMBER` or `RESTRICTED`.

  user

    Information about the user.

    Type:

      `telegram.User`

  status

    The member’s status in the chat. Can be `ADMINISTRATOR`, `OWNER`, `BANNED`, `LEFT`, `MEMBER` or `RESTRICTED`.

    Type:

      `str`

  ADMINISTRATOR = 'administrator'

    `telegram.constants.ChatMemberStatus.ADMINISTRATOR`

  BANNED = 'kicked'

    `telegram.constants.ChatMemberStatus.BANNED`

  LEFT = 'left'

    `telegram.constants.ChatMemberStatus.LEFT`

  MEMBER = 'member'

    `telegram.constants.ChatMemberStatus.MEMBER`

  OWNER = 'creator'

    `telegram.constants.ChatMemberStatus.OWNER`

  RESTRICTED = 'restricted'

    `telegram.constants.ChatMemberStatus.RESTRICTED`

  classmethod de_json(data, bot)

    See `telegram.TelegramObject.de_json()`.