Complete information about a particular chat.

Hierarchy (view full)

Constructors

Properties

distance?: number

Distance in meters of this group chat from your location Returned only in TelegramClient.getNearbyChats

peer:
    | RawUser
    | RawChat
    | RawChatForbidden
    | RawChannel
    | RawChannelForbidden

Raw peer object that this Chat represents.

type: "chat" = ...

Accessors

  • get color(): ChatColors
  • Color that should be used when rendering replies to the messages and web previews sent by this chat, as well as to render the chat title

    Returns ChatColors

  • get dcId(): null | number
  • User's or bot's assigned DC (data center). Available only in case the user has set a public profile photo.

    Note: this information is approximate; it is based on where Telegram stores the current chat photo. It is accurate only in case the owner has set the chat photo, otherwise it will be the DC assigned to the administrator who set the current profile photo.

    Returns null | number

  • get fullPhoto(): null | Photo
  • Full information about this chat's photo, if any.

    Unlike Chat.photo, this field contains additional information about the photo, such as its date, more sizes, and is the only way to get the animated profile photo.

    This field takes into account any personal/fallback photo that the user may have set

    Returns null | Photo

  • get inputPeer(): TypeInputPeer
  • Chat's input peer for advanced use-cases.

    Note: for min chats, this method will return mtcute.dummyInputPeerMin*, which are actually not a valid input peer, These are used to indicate that the user is incomplete, and a message reference is needed to resolve the peer.

    Such objects are handled by TelegramClient.resolvePeer method, so prefer using it whenever you need an input peer.

    Returns TypeInputPeer

  • get isMin(): boolean
  • Whether this chat's information is incomplete.

    This usually only happens in large chats, where the server sometimes sends only a part of the chat's information. Basic info like name and profile photo are always available, but other fields may be omitted despite being available.

    For a rough list of fields that may be missing, see the official docs for channel and user.

    This currently only ever happens for non-bot users, so if you are building a normal bot, you can safely ignore this field.

    To fetch the "complete" user information, use one of these methods:

    • TelegramClient.getChat
    • TelegramClient.getFullChat.

    Learn more: Incomplete peers

    Returns boolean

  • get profileColors(): ChatColors
  • Color that should be used when rendering the header of the user's profile

    If null, a generic header should be used instead

    Returns ChatColors

  • get subscriptionUntilDate(): null | Date
  • If a subscription to this channel was bought using Telegram Stars, this field will contain the date when the subscription will expire.

    Returns null | Date

Methods

  • Create a mention for the chat.

    If this is a user, works just like User.mention. Otherwise, if the chat has a username, a @username is created (or text link, if text is passed). If it does not, chat title is simply returned without additional formatting.

    When available and text is omitted, this method will return @username. Otherwise, text mention is created for the given (or default) parse mode

    Use null as text (first parameter) to force create a text mention with display name, even if there is a username.

    Note: This method doesn't format anything on its own. Instead, it returns a MessageEntity that can later be used with html or md template tags, or unparse method directly.

    Parameters

    • Optionaltext: null | string

      Text of the mention.

    Returns string | MessageEntity

    msg.replyText(html`Hello, ${msg.chat.mention()`)