ChatJoinRequestHandler¶
- class telegram.ext.ChatJoinRequestHandler(callback, chat_id=None, username=None, block=True)[source]¶
Bases:
telegram.ext.BaseHandler
Handler class to handle Telegram updates that contain
telegram.Update.chat_join_request
.Note
If neither of
username
and thechat_id
are passed, this handler accepts any join request. Otherwise, this handler accepts all requests to join chats for which the chat ID is listed inchat_id
or the username is listed inusername
, or both.Added in version 20.0.
Warning
When setting
block
toFalse
, you cannot rely on adding custom attributes totelegram.ext.CallbackContext
. See its docs for more info.Available In
Added in version 13.8.
- 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_id (
int
| Collection[int
], optional) –Filters requests to allow only those which are asking to join the specified chat ID(s).
Added in version 20.0.
username (
str
| Collection[str
], optional) –Filters requests to allow only those which are asking to join the specified username(s).
Added in version 20.0.
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