Documentation - v0.27.0
    Preparing search index...

    Full information about a particular chat.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    Properties

    distance?: number

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

    peers: PeersIndex

    Raw peer object that this Chat represents.

    type: "chat" = ...

    Accessors

    • get bannedUntilDate(): Date | null

      Date when the current user will be unbanned (if available)

      Returns null if the user is not banned, or if the ban is permanent

      Returns Date | null

    • get customVerificationEmojiId(): Long | null

      If non-null, this user was verified by a bot, and this field contains the ID of the custom emoji to display as the verification icon.

      Returns Long | null

    • get fullPhoto(): Photo | null

      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 Photo | null

    • 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 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 migratedFrom(): { chatId: number; msgId: number } | null

      For supergroups, ID of the basic group from which this supergroup was upgraded, and the identifier of the last message from the original group.

      Returns { chatId: number; msgId: number } | null

    • get migratedToId(): number | null

      If this chat is a basic group that has been migrated to a supergroup, this field will contain the marked ID of that supergroup.

      Returns number | null

    • 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()`)