telegram.ext.ChatMemberHandler¶
- class telegram.ext.ChatMemberHandler(callback, chat_member_types=-1, block=True)[source]¶
Bases:
telegram.ext.BaseHandler
BaseHandler class to handle Telegram updates that contain a chat member update.
Warning
When setting
block
toFalse
, you cannot rely on adding custom attributes totelegram.ext.CallbackContext
. See its docs for more info.Examples
New in version 13.4.
- 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_MEMBER
orANY_CHAT_MEMBER
to specify if this handler should handle only updates withtelegram.Update.my_chat_member
,telegram.Update.chat_member
or both. Defaults toMY_CHAT_MEMBER
.Determines whether the return value of the callback should be awaited before processing the next handler in
telegram.ext.Application.process_update()
. Defaults toTrue
.See also
- 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
- 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_member
andtelegram.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