Objects representing a channel.

Hierarchy (view full)

Properties

Accessors

Methods

Properties

channelType: ChannelType = ChannelType.BASE
coverUrl: string = ''

The cover image URL.

creator: null | User = null

A User who created the channel. null if it's created by system.

customType: string = ''

The custom type of the channel.

data: string = ''

The channel data.

isEphemeral: boolean = false

Whether the channel is ephemeral.

isFrozen: boolean = false

Whether the channel is frozen.

pinnedMessageIds: number[] = []

The pinned message IDs of the channel.

Accessors

  • get cachedMetaData(): object
  • All locally cached metadata as a map.

    Returns object

  • get createdAt(): number
  • The creation time of the channel in milliseconds.

    Returns number

  • get messageCollectionLastAccessedAt(): number
  • The local timestamp of when this channel has been used in a MessageCollection.

    Returns number

  • get name(): string
  • The topic or name of the channel.

    Returns string

  • set name(value): void
  • Parameters

    • value: string

    Returns void

  • get url(): string
  • The unique channel URL.

    Returns string

Methods

  • Parameters

    • userIds: string[]

    Returns Promise<void>

    Add operators to the channel.

  • Parameters

    • pollId: number
    • optionText: string

    Returns Promise<Poll>

    Adds an option with optionText to this poll. Once added successfully, a non-null Poll instance will be passed to the result.

  • Parameters

    • user: User
    • Optionalduration: number
    • Optionaldescription: string

    Returns Promise<void>

    Bans a member. Operators can ban members from this channel. Banned member is kicked out of this channel and cannot enter during the specified seconds. If you want to ban the user indefinitely, pass -1 to seconds as the argument.

  • Parameters

    • userId: string
    • Optionalduration: number
    • Optionaldescription: string

    Returns Promise<void>

    Bans a member with userId.

  • Parameters

    • requestId: string

    Returns Promise<boolean>

    Cancels an ongoing FileMessage upload.

  • Parameters

    • pollId: number

    Returns Promise<Poll>

    Closes this poll. Once closed successfully, a non-null Poll instance will be passed to the result.

  • Parameters

    Returns Promise<FileMessage>

    since v4.9.8. Use copyMessage() instead.

    Copies a file message from this channel to the target channel.

  • Parameters

    Returns Promise<UserMessage>

    since v4.9.8. Use copyMessage() instead.

    Copies a user message from this channel to the target channel.

  • Parameters

    Returns Promise<BaseMessage>

    Creates message meta array keys.

  • Parameters

    Returns Promise<MetaCounter>

    Creates meta counters. This can be used to customize the channel.

  • Parameters

    Returns Promise<MetaData>

    Creates meta data. This can be used to customize the channel.

  • Parameters

    • limit: number = DEFAULT_POLLS_LIMIT

    Returns PollListQuery

    Creates a query instance to get the poll list from this channel.

  • Parameters

    • pollId: number
    • pollOptionId: number
    • limit: number = DEFAULT_POLL_VOTER_LIST_LIMIT

    Returns PollVoterListQuery

    Creates a query instance to get the voters of a poll option.

  • Parameters

    Returns Promise<MetaCounter>

    Decreases meta counters. This decreases atomically the keyed meta counter by the specified value.

  • Returns Promise<void>

    Deletes all meta counters.

  • Returns Promise<void>

    Deletes all meta data.

  • Parameters

    Returns Promise<void>

    Deletes a message.

  • Parameters

    Returns Promise<BaseMessage>

    Deletes message meta array keys.

  • Parameters

    • key: string

    Returns Promise<void>

    Deletes a meta counter.

  • Parameters

    • key: string

    Returns Promise<void>

    Deletes a meta data.

  • Parameters

    • pollId: number

    Returns Promise<void>

    Deletes this poll. Once deleted successfully, null will be passed to the result.

  • Parameters

    • pollId: number
    • pollOptionId: number

    Returns Promise<void>

    Deletes this poll option.

  • Returns Promise<void>

    Freezes the channel. No one could send a message in a frozen channel.

  • Returns Promise<MetaData>

    Gets all meta data.

  • Parameters

    Returns Promise<BaseMessage[]>

    Retrieves previous or next messages based on the message ID in a specific channel.

  • Parameters

    Returns Promise<BaseMessage[]>

    Retrieves previous or next messages based on the timestamp in a specific channel.

  • Parameters

    • keys: string[]

    Returns Promise<MetaCounter>

    Gets meta counters.

  • Parameters

    • keys: string[]

    Returns Promise<MetaData>

    Gets meta data.

  • Returns Promise<MutedInfo>

    Gets my muted information in this channel.

  • Parameters

    • ts: number

    Returns Promise<PollChangelogs>

    Requests poll change logs after given timestamp.

  • Parameters

    • token: null | string

    Returns Promise<PollChangelogs>

    Requests poll change logs after given token.

  • Parameters

    Returns Promise<MetaCounter>

    Increases meta counters. This increases atomically the keyed meta counter by the specified value.

  • Parameters

    Returns boolean

    Whether the given channel is equal in all the values of this channel.

  • Parameters

    Returns boolean

    Whether the given channel is identical to this channel.

  • Parameters

    • user: User
    • Optionalduration: number
    • Optionaldescription: string

    Returns Promise<void>

    Mutes a User. A muted user cannot send a message.

  • Parameters

    • userId: string
    • Optionalduration: number
    • Optionaldescription: string

    Returns Promise<void>

    Mutes a User with userId. A muted user cannot send a message.

  • Parameters

    • messageId: number

    Returns Promise<void>

    Pins a message to the channel.

  • Parameters

    • userIds: string[]

    Returns Promise<void>

    Remove operators from the channel.

  • Parameters

    Returns Promise<void>

    Reports this channel of inappropriate activities.

  • Parameters

    Returns Promise<void>

    Reports a malicious message.

  • Parameters

    Returns Promise<void>

    Reports a user of suspicious activities.

  • Parameters

    Returns Promise<FileMessage>

    since v4.9.8. Use resendMessage() instead.

    Resends a file with given file information.

  • Parameters

    Returns Promise<UserMessage>

    since v4.9.8. Use resendMessage() instead.

    Resends a failed user message.

  • Parameters

    Returns MessageRequestHandler<SendableMessage>

    Sends files with given files information. The maximum number of files is 20. This method handles FileMessageCreateParams only which have set binary file not URL.

  • Parameters

    Returns Promise<UserMessage>

    Translates a user message.

  • Parameters

    Returns Promise<void>

    Unbans User. Operators can unban User who has been banned from this channel.

  • Parameters

    • userId: string

    Returns Promise<void>

    Unbans User with userId.

  • Returns Promise<void>

    Unfreezes the channel.

  • Parameters

    Returns Promise<void>

    Unmutes User. The unmuted user could send a message again.

  • Parameters

    • userId: string

    Returns Promise<void>

    Unmutes User with userId. The unmuted user could send a message again.

  • Parameters

    • messageId: number

    Returns Promise<void>

    Removes the message from the channel's pinned messages.

  • Parameters

    Returns Promise<FileMessage>

    Updates a FileMessage that was previously sent in the channel. Note that the file itself cannot be changed; only the fields stored within the message can be modified.

  • Parameters

    Returns Promise<MetaCounter>

    Updates meta counters.

  • Parameters

    Returns Promise<MetaData>

    Updates meta data.

  • Parameters

    Returns Promise<Poll>

    Updates fields of this poll with given params. Once updated successfully, a non-null Poll instance will be passed to the result.

  • Parameters

    • pollId: number
    • pollOptionId: number
    • optionText: string

    Returns Promise<Poll>

    Updates optionText fields of this poll option. Once updated successfully, a non-null Poll instance will be passed to the result.

  • Parameters

    Returns Promise<FileUploadResult>

    Uploads a file and gets the URL and thumbnails. It takes progressHandler as a parameter to keep track of upload progress.

  • Parameters

    • pollId: number
    • pollOptionIds: number[]

    Returns Promise<PollVoteEvent>

    Vote on pollOptionIds. This operation overrides previous vote actions, so to update previous vote, pass new pollOptionIds as parameter. To cancel votes, pass an empty list as pollOptionIds.