Class ChatMember

Hierarchy (view full)

Constructors

  • Parameters

    • client: TelegramClient | BaseClient

      The client that instantiated this

    • chatId: string | number

      Identifier of the chat

    • data: ChatMember

      Data about the contains information about one member of a chat

    Returns ChatMember

Properties

anonymous: boolean

True, if the user's presence in the chat is hidden

chatId: string

Identifier of the chat

isMember?: boolean

True, if the user is a member of the chat at the moment of the request

nickName?: string

Custom title for this user

permissions: UserPermissions

Represents the rights of an administrator in a chat

status:
    | "creator"
    | "administrator"
    | "member"
    | "restricted"
    | "left"
    | "kicked"

The member's status in the chat

untilUnixTime?: number

Date when the user's subscription will expire; Unix time

user?: User

Information about the user

Accessors

  • get id(): null | string
  • Return the member id

    Returns null | string

  • get untilAt(): null | Date
  • Date the user's subscription will expire

    Returns null | Date

  • get untilTimestamp(): null | number
  • Date when the user's subscription will expire, in milliseconds

    Returns null | number

Methods

  • Protected

    Creates a clone of the current instance

    Returns Base

    A clone of the current instance

  • Parameters

    • data: ChatMember

      Data about the contains information about one member of a chat

    Returns ChatMember

  • Protected

    Updates the current instance with new data and returns a clone of the updated instance

    Parameters

    • data: Record<string, any>

      The data to update the instance with

    Returns Base

    A clone of the updated instance

  • Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.

    Parameters

    • Optionaloptions: Omit<{
          chatId: string | number;
          revokeMessages?: boolean;
          untilDate?: number;
          userId: string | number;
      }, "chatId" | "userId">

    Returns Promise<true>

    Returns True on success.

  • Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, the owner of the banned chat won't be able to send messages on behalf of any of their channels. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights.

    Parameters

    • senderChatId: string | number

      Unique identifier of the target sender chat

    Returns Promise<true>

    Returns True on success.

  • Checks if this member is equal to another member.

    Parameters

    • other: ChatMember

      The other object to compare with.

    Returns boolean

    True if both objects are instances of ChatMember and are equal based on key properties, otherwise false.

  • Use this method to kick a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.

    Parameters

    • Optionaloptions: Omit<{
          chatId: string | number;
          revokeMessages?: boolean;
          untilDate?: number;
          userId: string | number;
      }, "chatId" | "userId">

    Returns Promise<true>

    Returns True on success.

  • Retrieves the permissions of the current member in a specific chat.

    Parameters

    • channel: string | ChatMember

      The identifier of the chat channel.

    • OptionalcheckAdmin: boolean

      A flag to check if the member is an admin or creator.

    Returns Promise<null | UserPermissions>

    The permissions object of the user in the chat or null if not available.

  • Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Pass False for all boolean parameters to demote a user.

    Parameters

    • persm: ChatPermissionFlags

      An object for new user permissions

    • OptionalisAnonymous: boolean

      Pass True if the administrator's presence in the chat is hidden

    Returns Promise<true>

    Returns True on success.

  • Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate administrator rights. Pass True for all permissions to lift restrictions from a user. Returns True on success.

    Parameters

    • perms: ChatPermissionFlags

      An object for new user permissions

    • Optionaloptions: Omit<{
          chatId: string | number;
          permissions: ChatPermissionFlags;
          untilDate?: number;
          useIndependentChatPermissions?: boolean;
          userId: string | number;
      }, "chatId" | "userId" | "permissions">

      out parameters

    Returns Promise<true>

    Returns True on success.

  • Use this method to set a custom title for an administrator in a supergroup promoted by the bot.

    Parameters

    • name: string

      New custom title for the administrator; 0-16 characters, emoji are not allowed

    Returns Promise<true>

    Returns True on success.

  • Flatten an object. Any properties that are collections will get converted to an array of keys.

    Parameters

    • OptionalpropsRecursive: boolean

      Optional. If true, calls toJSON method on nested objects.

    • Rest...props: Record<string, string | boolean>[]

      Optional. Specific properties to include/exclude, or rename.

    Returns Record<string, any>

    Flattened object.

  • Use this method to unban a previously banned user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. By default, this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So if the user is a member of the chat they will also be removed from the chat. If you don't want this, use the parameter only_if_banned.

    Parameters

    • OptionalonlyIfBanned: boolean

      Do nothing if the user is not banned

    Returns Promise<true>

    Returns True on success.

  • Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights.

    Parameters

    • senderChatId: string | number

      Unique identifier of the target sender chat

    Returns Promise<true>

    Returns True on success.

  • Returns the id instance Chat, User, ChatMember and other

    Returns null | string