ChatJoinRequest

class telegram.ChatJoinRequest(chat, from_user, date, user_chat_id, bio=None, invite_link=None, *, api_kwargs=None)[source]

Bases: telegram.TelegramObject

This 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_user and date are 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_users administrator right - even if the user never interacted with the bot before.

  • Telegram does not guarantee that from_user.id coincides with the chat_id of the user. Please use user_chat_id to contact the user in response to their join request.

New in version 13.8.

Changed in version 20.1: In Bot API 6.5 the argument user_chat_id was added, which changes the position of the optional arguments bio and invite_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.tzinfo is 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.

    New 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.

chat[source]

Chat to which the request was sent.

Type:

telegram.Chat

from_user[source]

User that sent the join request.

Type:

telegram.User

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.tzinfo is 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.

New in version 20.1.

Type:

int

bio[source]

Optional. Bio of the user.

Type:

str

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:

telegram.ChatInviteLink

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, True is returned.

Return type:

bool

classmethod de_json(data, bot)[source]

See telegram.TelegramObject.de_json().

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, True is returned.

Return type:

bool