Documentation - v0.27.0
    Preparing search index...

    A chat.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    distance?: number

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

    Raw peer object that this Chat represents.

    type: "chat" = ...

    Accessors

    • get isBanned(): boolean

      Whether the chat is not available (e.g. because the user was banned from there).

      Note: This method checks if the underlying peer is chatForbidden or channelForbidden. In some cases this field might be false even if the user is not a member of the chat, and calling .getChat() will throw CHANNEL_PRIVATE. In particular, this seems to be the case for .forward.sender of Message objects.

      Consider also checking for isLikelyUnavailable.

      Returns boolean

    • get isLikelyUnavailable(): boolean

      Whether the chat is likely not available (e.g. because the user was banned from there), or the channel is private and the user is not a member of it.

      Returns boolean

    • 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" chat information, use one of these methods:

      Learn more: Incomplete peers

      Returns boolean

    • get monoforumLinkedChatId(): number | null

      Depending on chatType:

      • channel: this field might contain the ID of the linked monoforum, if this broadcast channel has a linked monoforum
      • monoforum: this field contains the ID of the channel that this monoforum is linked to

      Returns number | null

    • get subscriptionUntilDate(): Date | null

      If a subscription to this channel was bought using Telegram Stars, this field will contain the date when the subscription will expire.

      Returns Date | null

    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: string | null

        Text of the mention.

      Returns string | MessageEntity

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