get_chat()#

Client.get_chat()#

Get up to date information about a chat.

Information include current name of the user for one-on-one conversations, current username of a user, group or channel, etc.

Usable by Users Bots
Parameters:
  • chat_id (int | str) – Unique identifier (int) or username (str) of the target chat. Unique identifier for the target chat in form of a t.me/joinchat/ link, identifier (int) or username of the target channel/supergroup (in the format @username).

  • force_full (bool, optional) – Pass False, if you don’t need to fetch full chat information. Defaults to True.

Returns:

Chat – On success, if you’ve already joined the chat, a chat object is returned, otherwise, a chat preview object is returned.

Raises:

ValueError – In case the chat invite link points to a chat you haven’t joined yet.

Example

chat = await app.get_chat("pyrogram")
print(chat)