Full information about a particular chat.

Hierarchy (View Summary)

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 adminRights(): null | RawChatAdminRights
  • Admin rights of the current user in this chat, if any.`

    Returns null | RawChatAdminRights

  • get adminsCount(): number
  • Number of admins in the chat (0 if not available)

    Returns number

  • get availableReactions(): null | TypeChatReactions
  • Reactions available in this chat

    Returns null | TypeChatReactions

  • get bannedCount(): null | number
  • Number of users kicked from the chat (if available)

    Returns null | number

  • get bannedUntilDate(): null | Date
  • 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 null | Date

  • get bio(): string
  • Bio of the other party in a private chat, or description of a group, supergroup or channel.

    Returns string

  • get boostsApplied(): number
  • Number of boosts applied by the current user to this chat.

    Returns number

  • get boostsForUnrestrict(): number
  • Number of boosts required for the user to be unrestricted in this chat.

    Returns number

  • get boostsLevel(): number
  • Boosts level this chat has (0 if none or is not a channel)

    Returns number

  • get botInfo(): BotInfo[]
  • Information about bots in this chat

    Returns BotInfo[]

  • get botVerification(): null | BotVerification
  • Information about a bot-issued verification (if any)

    Returns null | BotVerification

  • get canDeleteChat(): boolean
  • Whether the current user can delete the chat

    Returns boolean

  • get canSetStickers(): boolean
  • Whether the current user can change the chat's sticker set

    Returns boolean

  • get canSetStickerSet(): null | boolean
  • Whether the group sticker set can be changed by you.

    Returns null | boolean

  • get canSetUsername(): boolean
  • Whether the current user can change the chat's username

    Returns boolean

  • get canViewAdRevenue(): boolean
  • Whether the current user can view ad revenue for this chat

    Returns boolean

  • get canViewParticipants(): boolean
  • Whether the current user can view the chat's participants list

    Returns boolean

  • get canViewStarsRevenue(): boolean
  • Whether the current user can view Telegram Stars revenue for this chat

    Returns boolean

  • get canViewStats(): boolean
  • Whether the current user can view the chat's statistics

    Returns boolean

  • get chatType(): ChatType
  • Type of chat

    Returns ChatType

  • 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 creationDate(): null | Date
  • Date when the chat was created (if available)

    Returns null | Date

  • get customVerificationEmojiId(): null | Long
  • 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 null | Long

  • get defaultPermissions(): null | ChatPermissions
  • Default chat member permissions, for groups and supergroups.

    Returns null | ChatPermissions

  • get displayName(): string
  • Get the display name of the chat.

    Basically an alias to title, exists for consistency with User.

    Returns string

  • get emojiSet(): null | StickerSet
  • For supergroups, information about the group emoji set.

    Returns null | StickerSet

  • get emojiStatus(): null | EmojiStatus
  • Chat's emoji status, if any.

    Returns null | EmojiStatus

  • 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 hasAdsDisabled(): boolean
  • Whether ads on this channels were disabled (this flag is only visible to channel owner)

    Returns boolean

  • get hasCall(): boolean
  • Whether this chat has a call/livestrean active

    Returns boolean

  • get hasCallMembers(): boolean
  • Whether this chat has a call/livestream, and there's at least one member in it

    Returns boolean

  • get hasContentProtection(): boolean
  • Whether this group has content protection (i.e. disabled forwards)

    Returns boolean

  • get hasHiddenHistory(): boolean
  • Whether the history before we joined the chat is hidden

    Returns boolean

  • get hasHiddenParticipants(): boolean
  • Whether this channel has hidden participants

    Returns boolean

  • get hasJoinRequests(): boolean
  • Whether this group is a channel/supergroup with join requests enabled

    Returns boolean

  • get hasJoinToSend(): boolean
  • Whether this group is a supergroup with join-to-send rule enabled

    Returns boolean

  • get hasNativeAntispam(): boolean
  • Whether the native antispam is enabled for this channel

    Returns boolean

  • get hasPaidReactions(): boolean
  • Whether paid reactions are enabled for this channel

    Returns boolean

  • get hasPinnedStories(): boolean
  • Whether this chat has pinned stories

    Returns boolean

  • get hasProfileSignatures(): boolean
  • Whether this channel has profile signatures (i.e. "Super Channel")

    Returns boolean

  • get hasScheduledMessages(): boolean
  • Whether there are scheduled messages in this chat

    Returns boolean

  • get hasSignatures(): boolean
  • Whether this channel has author signatures enabled under posts

    Returns boolean

  • get hasTranslationsDisabled(): boolean
  • Whether the real-time translations popup should not be shown for this channel

    Returns boolean

  • get historyMinId(): number
  • For supergroups with hidden history, ID of the first message visible to the current user

    Returns number

  • get id(): number
  • Marked ID of this chat

    Returns number

  • 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

  • Chat's primary invite link, if available

    Returns null | ChatInviteLink

  • get isAdmin(): boolean
  • Whether current user has admin rights in this chat. Supergroups, channels and groups only.

    Returns boolean

  • get isArchived(): boolean
  • Whether this chat is archived

    Returns boolean

  • 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 isBlocked(): boolean
  • Whether the current user has blocked any anonumous admin of the supergroup. If set, you won't receive mentions from them, nor their replies in @replies

    Returns boolean

  • get isCreator(): boolean
  • Whether this chat is owned by the current user. Supergroups, channels and groups only

    Returns boolean

  • get isFake(): boolean
  • Whether this chat has been flagged for impersonation

    Returns boolean

  • get isForum(): boolean
  • Whether this peer is a forum supergroup

    Returns boolean

  • get isGroup(): boolean
  • Whether this chat is a group chat (i.e. not a channel)

    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 isMember(): boolean
  • Whether the current user is a member of the chat.

    For users, this is always true.

    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 isPaidMediaAvailable(): boolean
  • Whether sending paid media is available in this channel

    Returns boolean

  • get isRestricted(): boolean
  • Whether this chat has been restricted. See restrictions for details

    Returns boolean

  • get isScam(): boolean
  • Whether this chat has been flagged for scam

    Returns boolean

  • get isVerified(): boolean
  • Whether this chat has been verified by Telegram. Supergroups, channels and groups only

    Returns boolean

  • get joinDate(): null | Date
  • Date when the current user joined this chat (if available)

    Returns null | Date

  • get kickedCount(): null | number
  • Number of users kicked from the chat (if available)

    Returns null | number

  • get linkedChat(): null | Chat
  • Information about a linked chat:

    • for channels: the discussion group
    • for supergroups: the linked channel

    Returns null | Chat

  • get location(): null | ChatLocation
  • Location of the chat.

    Returns null | ChatLocation

  • get maxReactions(): null | number
  • Maximum number of unique reactions on a single message in this chat, if any

    Returns null | number

  • get membersCount(): null | number
  • Number of members in this chat (if available)

    Returns null | number

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

  • get migratedTo(): null | TypeInputChannel
  • If this chat is a basic group that has been migrated to a supergroup, this field will contain the input peer of that supergroup.

    Returns null | TypeInputChannel

  • get migratedToId(): null | number
  • 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 null | number

  • get onlineCount(): number
  • Number of members of the chat that are currently online

    Returns number

  • get pendingJoinRequests(): number
  • Number of pending join requests in the chat (only visible to admins)

    Returns number

  • get permissions(): null | ChatPermissions
  • Current user's permissions, for supergroups.

    Returns null | ChatPermissions

  • get photo(): null | ChatPhoto
  • Chat photo, if any. Suitable for downloads only.

    If full chat information is available, prefer FullChat#fullPhoto instead.

    Returns null | ChatPhoto

  • get pinnedMsgId(): null | number
  • ID of the last pinned message in the chat

    Returns null | number

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

    Returns ChatColors

  • get readInboxMaxId(): number
  • ID of the last read incoming message in the chat

    Returns number

  • get readOutboxMaxId(): number
  • ID of the last read outgoing message in the chat

    Returns number

  • get recentRequesters(): User[]
  • Users who have recently requested to join the chat (only visible to admins)

    Returns User[]

  • get restrictions(): null | readonly RawRestrictionReason[]
  • The list of reasons why this chat might be unavailable to some users. This field is available only in case isRestricted is true

    Returns null | readonly RawRestrictionReason[]

  • get slowmodeNextSendDate(): null | Date
  • For supergroups with slow mode, date of the next time the current user will be able to send a message. null if they can send messages now.

    Returns null | Date

  • get slowmodeSeconds(): null | number
  • Slowmode delay for this chat, if any

    Returns null | number

  • get stickerSet(): null | StickerSet
  • For supergroups, information about the group sticker set.

    Returns null | StickerSet

  • get stories(): null | PeerStories
  • Channel stories

    Returns null | PeerStories

  • get storiesHidden(): boolean
  • Whether you have hidden (arhived) this chat's stories

    Returns boolean

  • get storiesMaxId(): number
  • Maximum ID of stories this chat has (or 0 if none)

    Returns number

  • get storiesUnavailable(): boolean
  • Returns boolean

  • 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

  • get title(): string
  • Chat title

    Returns string

  • get ttlPeriod(): null | number
  • TTL of all messages in this chat, in seconds

    Returns null | number

  • get unreadCount(): number
  • Number of unread messages in the chat

    Returns number

  • get username(): null | string
  • Chat username (if available)

    Returns null | string

  • get usernames(): null | readonly RawUsername[]
  • Usernames (including collectibles), for private chats, bots, supergroups and channels if available

    Returns null | readonly RawUsername[]

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