answer_chat_join_request_query()¶
- Client.answer_chat_join_request_query()¶
Answer a chat join request query received via
ChatJoinRequest.When a chat uses a guard bot and a user requests to join, the guard bot receives a
Usable by Users BotsChatJoinRequestwith aquery_id. The bot must call this method to act on the request.- Parameters:
query_id (
int) – Unique identifier of the query (ChatJoinRequest.query_id).action (
str) – Decision for the join request. One of:"approve"— approve the user immediately."decline"— reject the join request."queue"— hold the request for later review."web_view"— open a WebApp for the user (requiresurl).
url (
str, optional) – HTTPS URL of the WebApp to open. Required whenaction="web_view".
- Returns:
bool– True on success.- Raises:
ValueError – On unknown action or missing url for web_view.
Example
@app.on_chat_join_request() async def handler(client, request): if request.query_id: await client.answer_chat_join_request_query( request.query_id, "approve" ) else: await request.approve()