telegram.ext.ChatMemberHandler#
- class telegram.ext.ChatMemberHandler(callback, chat_member_types=- 1, block=True)[source]#
Bases:
telegram.ext.HandlerHandler class to handle Telegram updates that contain a chat member update.
New in version 13.4.
Warning
When setting
blocktoFalse, you cannot rely on adding custom attributes totelegram.ext.CallbackContext. See its docs for more info.- Parameters
callback (coroutine function) –
The callback function for this handler. Will be called when
check_update()has determined that an update should be processed by this handler. Callback signature:async def callback(update: Update, context: CallbackContext)
The return value of the callback is usually ignored except for the special case of
telegram.ext.ConversationHandler.chat_member_types (
int, optional) – Pass one ofMY_CHAT_MEMBER,CHAT_MEMBERorANY_CHAT_MEMBERto specify if this handler should handle only updates withtelegram.Update.my_chat_member,telegram.Update.chat_memberor both. Defaults toMY_CHAT_MEMBER.block (
bool, optional) – Determines whether the return value of the callback should be awaited before processing the next handler intelegram.ext.Application.process_update(). Defaults toTrue.
- chat_member_types[source]#
Specifies if this handler should handle only updates with
telegram.Update.my_chat_member,telegram.Update.chat_memberor both.- Type
int, optional
- 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
- ANY_CHAT_MEMBER = 1[source]#
Used as a constant to handle both
telegram.Update.my_chat_memberandtelegram.Update.chat_member.- Type
- CHAT_MEMBER = 0[source]#
Used as a constant to handle only
telegram.Update.chat_member.- Type
- MY_CHAT_MEMBER = -1[source]#
Used as a constant to handle only
telegram.Update.my_chat_member.- Type