A chat.

Hierarchy (View Summary)

Constructors

  • Parameters

    Returns Chat

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

    Returns null | RawChatAdminRights

  • 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 boostsLevel(): number
  • Boosts level this chat has (0 if none or is not a channel)

    Returns number

  • 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 emojiStatus(): null | EmojiStatus
  • Chat's emoji status, if any.

    Returns null | EmojiStatus

  • 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 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 hasProfileSignatures(): boolean
  • Whether this channel has profile signatures (i.e. "Super Channel")

    Returns boolean

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

    Returns boolean

  • 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

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

    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 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 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 membersCount(): null | number
  • Number of members in this chat (if available)

    Returns null | 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 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 profileColors(): ChatColors
  • Color that should be used when rendering the header of the user's profile

    Returns ChatColors

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