ChatMemberHandler

class telegram.ext.ChatMemberHandler(callback, chat_member_types=-1, block=True, chat_id=None)[source]

Bases: telegram.ext.BaseHandler

Handler class to handle Telegram updates that contain a chat member update.

Warning

When setting block to False, you cannot rely on adding custom attributes to telegram.ext.CallbackContext. See its docs for more info.

Examples

Chat Member Bot

Added in version 13.4.

Parameters:
callback[source]

The callback function for this handler.

Type:

coroutine function

chat_member_types[source]

Optional. Specifies if this handler should handle only updates with telegram.Update.my_chat_member, telegram.Update.chat_member or both.

Type:

int

block[source]

Determines whether the return value of the callback should be awaited before processing the next handler in telegram.ext.Application.process_update().

Type:

bool

ANY_CHAT_MEMBER = 1[source]

Used as a constant to handle both telegram.Update.my_chat_member and telegram.Update.chat_member.

Type:

int

CHAT_MEMBER = 0[source]

Used as a constant to handle only telegram.Update.chat_member.

Type:

int

MY_CHAT_MEMBER = -1[source]

Used as a constant to handle only telegram.Update.my_chat_member.

Type:

int

check_update(update)[source]

Determines whether an update should be passed to this handler’s callback.

Parameters:

update (telegram.Update | object) – Incoming update.

Returns:

bool