Class REST/Channels

Various methods for interacting with channels. Located at Client#rest.channels.

Constructors

Methods

  • Add a user to a group channel.

    Parameters

    • groupID: string

      The ID of the group to add the user to.

    • options: AddGroupRecipientOptions

      The options for adding the recipient.

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • Add a member to a thread.

    Parameters

    • channelID: string

      The ID of the thread to add them to.

    • userID: string

      The ID of the user to add to the thread.

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • Add a reaction to a message.

    Parameters

    • channelID: string

      The ID of the channel the message is in.

    • messageID: string

      The ID of the message to add a reaction to.

    • emoji: string

      The reaction to add to the message. name:id for custom emojis, and the unicode codepoint for default emojis.

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • Delete or close a channel.

    Parameters

    • channelID: string

      The ID of the channel to delete or close.

    • Optional reason: string

      The reason to be displayed in the audit log.

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • Delete a message.

    Parameters

    • channelID: string

      The ID of the channel to delete the message in.

    • messageID: string

      The ID of the message to delete.

    • Optional reason: string

      The reason for deleting the message.

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • Bulk delete messages.

    Parameters

    • channelID: string

      The ID of the channel to delete the messages in.

    • messageIDs: string[]

      The IDs of the messages to delete. Any duplicates or messages older than two weeks will cause an error.

    • Optional reason: string

      The reason for deleting the messages.

    Returns Promise<number>

    Caching

    This method does not cache its result.

  • Delete a permission overwrite.

    Parameters

    • channelID: string

      The ID of the channel to delete the permission overwrite in.

    • overwriteID: string

      The ID of the permission overwrite to delete.

    • Optional reason: string

      The reason for deleting the permission overwrite.

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • Remove a reaction from a message.

    Parameters

    • channelID: string

      The ID of the channel the message is in.

    • messageID: string

      The ID of the message to remove a reaction from.

    • emoji: string

      The reaction to remove from the message. name:id for custom emojis, and the unicode codepoint for default emojis.

    • user: string = "@me"

      The user to remove the reaction from, @me for the current user (default).

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • Remove all, or a specific emoji's reactions from a message.

    Parameters

    • channelID: string

      The ID of the channel the message is in.

    • messageID: string

      The ID of the message to remove reactions from.

    • Optional emoji: string

      The reaction to remove from the message. name:id for custom emojis, and the unicode codepoint for default emojis. Omit to remove all reactions.

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • Delete a stage instance.

    Parameters

    • channelID: string

      The ID of the channel to delete the stage instance on.

    • Optional reason: string

      The reason for deleting the stage instance.

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • Edit a permission overwrite.

    Parameters

    • channelID: string

      The ID of the channel to edit the permission overwrite for.

    • overwriteID: string

      The ID of the permission overwrite to edit.

    • options: EditPermissionOptions

      The options for editing the permission overwrite.

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • End a poll now.

    Parameters

    • channelID: string

      The ID of the channel the poll is in.

    • messageID: string

      The ID of the message the poll is on.

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • Follow an announcement channel.

    Parameters

    • channelID: string

      The ID of the channel to follow announcements from.

    • webhookChannelID: string

      The ID of the channel crossposted messages should be sent to. The client must have the MANAGE_WEBHOOKS permission in this channel.

    Returns Promise<FollowedChannel>

    Caching

    This method does not cache its result.

  • Get the users that voted on a poll answer.

    Parameters

    • channelID: string

      The ID of the channel the poll is in.

    • messageID: string

      The ID of the message the poll is on.

    • answerID: number

      The ID of the poll answer to get voters for.

    • Optional options: GetPollAnswerUsersOptions

      The options for getting the voters.

    Returns Promise<User[]>

    Caching

    This method does cache its result.

    Caches

    Client#users

  • Get the users who reacted with a specific emoji on a message.

    Parameters

    • channelID: string

      The ID of the channel the message is in.

    • messageID: string

      The ID of the message to get reactions from.

    • emoji: string

      The reaction to remove from the message. name:id for custom emojis, and the unicode codepoint for default emojis.

    • Optional options: GetReactionsOptions

      The options for getting the reactions.

    Returns Promise<User[]>

    Caching

    This method does not cache its result.

  • Join a thread.

    Parameters

    • channelID: string

      The ID of the thread to join.

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • Leave a thread.

    Parameters

    • channelID: string

      The ID of the thread to leave.

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • Pin a message in a channel.

    Parameters

    • channelID: string

      The ID of the channel to pin the message in.

    • messageID: string

      The ID of the message to pin.

    • Optional reason: string

      The reason for pinning the message.

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • Remove a user from the group channel.

    Parameters

    • groupID: string

      The ID of the group to remove the user from.

    • userID: string

      The ID of the user to remove.

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • Remove a member from a thread.

    Parameters

    • channelID: string

      The ID of the thread to remove them from.

    • userID: string

      The ID of the user to remove from the thread.

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • Show a typing indicator in a channel. How long users see this varies from client to client.

    Parameters

    • channelID: string

      The ID of the channel to show the typing indicator in.

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • Set a voice status in a channel.

    Parameters

    • channelID: string

      The ID of the channel to set the voice status in.

    • status: null | string

      The voice status to set.

    Returns Promise<void>

  • Unpin a message in a channel.

    Parameters

    • channelID: string

      The ID of the channel to unpin the message in.

    • messageID: string

      The ID of the message to unpin.

    • Optional reason: string

      The reason for unpinning the message.

    Returns Promise<void>

    Caching

    This method does not cache its result.