ChatJoinRequest¶
- class telegram.ChatJoinRequest(chat, from_user, date, user_chat_id, bio=None, invite_link=None, *, api_kwargs=None)[source]¶
Bases:
telegram.TelegramObjectThis object represents a join request sent to a chat.
Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their
chat,from_useranddateare equal.Note
Since Bot API 5.5, bots are allowed to contact users who sent a join request to a chat where the bot is an administrator with the
can_invite_usersadministrator right - even if the user never interacted with the bot before.Telegram does not guarantee that
from_user.idcoincides with thechat_idof the user. Please useuser_chat_idto contact the user in response to their join request.
Available In
Added in version 13.8.
Changed in version 20.1: In Bot API 6.5 the argument
user_chat_idwas added, which changes the position of the optional argumentsbioandinvite_link.- Parameters:
chat (
telegram.Chat) – Chat to which the request was sent.from_user (
telegram.User) – User that sent the join request.date (
datetime.datetime) –Date the request was sent.
Changed in version 20.3: The default timezone of the bot is used for localization, which is UTC unless
telegram.ext.Defaults.tzinfois used.user_chat_id (
int) –Identifier of a private chat with the user who sent the join request. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 5 minutes to send messages until the join request is processed, assuming no other administrator contacted the user.
Added in version 20.1.
bio (
str, optional) – Bio of the user.invite_link (
telegram.ChatInviteLink, optional) – Chat invite link that was used by the user to send the join request.
- date[source]¶
Date the request was sent.
Changed in version 20.3: The default timezone of the bot is used for localization, which is UTC unless
telegram.ext.Defaults.tzinfois used.- Type:
datetime.datetime
- user_chat_id[source]¶
Identifier of a private chat with the user who sent the join request. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 24 hours to send messages until the join request is processed, assuming no other administrator contacted the user.
Added in version 20.1.
- Type:
int
- invite_link[source]¶
Optional. Chat invite link that was used by the user to send the join request.
Note
When a user joins a public group via an invite link, this attribute may not be present. However, this behavior is undocument and may be subject to change. See this GitHub thread for some discussion.
- Type:
- async approve(*, read_timeout=None, write_timeout=None, connect_timeout=None, pool_timeout=None, api_kwargs=None)[source]¶
Shortcut for:
await bot.approve_chat_join_request( chat_id=update.effective_chat.id, user_id=update.effective_user.id, *args, **kwargs )
For the documentation of the arguments, please see
telegram.Bot.approve_chat_join_request().- Returns:
On success,
Trueis returned.- Return type:
bool
- async decline(*, read_timeout=None, write_timeout=None, connect_timeout=None, pool_timeout=None, api_kwargs=None)[source]¶
Shortcut for:
await bot.decline_chat_join_request( chat_id=update.effective_chat.id, user_id=update.effective_user.id, *args, **kwargs )
For the documentation of the arguments, please see
telegram.Bot.decline_chat_join_request().- Returns:
On success,
Trueis returned.- Return type:
bool