ChannelsAPI

export declare class ChannelsAPI
export declare class ChannelsAPI

No summary provided.

constructor(rest)
Constructs a new instance of the ChannelsAPI class
NameTypeOptionalDescription
restRESTNoNone
addMessageReaction(channelId, messageId, emoji, options?):Promise<void>
Adds a reaction to a message
Example
// Unicode.
await api.channels.addMessageReaction('1234567890', '1234567890', '👍');

// Custom emoji.
await api.channels.addMessageReaction('1234567890', '1234567890', 'emoji_name:1234567890');
// Unicode.
await api.channels.addMessageReaction('1234567890', '1234567890', '👍');

// Custom emoji.
await api.channels.addMessageReaction('1234567890', '1234567890', 'emoji_name:1234567890');
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel the message is in
messageIdSnowflakeNoThe id of the message to add the reaction to
emojistringNoThe emoji to add the reaction with. URL encoding happens internally
optionsPick<RequestData, 'signal'>YesThe options for adding the reaction
bulkDeleteMessages(channelId, messageIds, options?):Promise<void>
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel the messages are in
messageIdsSnowflake[]NoThe ids of the messages to delete
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for deleting the messages
createForumThread(channelId, body, options?):Promise<APIThreadChannel>
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the forum channel to start the thread in
bodyStartForumThreadOptionsNoThe data for starting the thread
optionsPick<RequestData, 'signal'>YesThe options for starting the thread
createInvite(channelId, body, options?):Promise<APIExtendedInvite>
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel to create an invite for
bodyRESTPostAPIChannelInviteJSONBodyNoThe data for creating the invite
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for creating the invite
createMessage(channelId, body, options?):Promise<APIMessage>
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel to send the message in
bodyRESTPostAPIChannelMessageJSONBody & { files?: RawFile[]; }NoThe data for sending the message
optionsPick<RequestData, 'signal'>YesThe options for sending the message
createThread(channelId, body, messageId?, options?):Promise<APIChannel>
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel to start the thread in
bodyRESTPostAPIChannelThreadsJSONBodyNoThe data for starting the thread
messageIdSnowflakeYesThe id of the message to start the thread from
optionsPick<RequestData, 'signal'>YesThe options for starting the thread
createWebhook(channelId, body, options?):Promise<APIWebhook>
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel to create the webhook in
bodyRESTPostAPIChannelWebhookJSONBodyNoThe data for creating the webhook
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for creating the webhook
crosspostMessage(channelId, messageId, options?):Promise<APIMessage>
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel the message is in
messageIdSnowflakeNoThe id of the message to crosspost
optionsPick<RequestData, 'signal'>YesThe options for crossposting the message
delete(channelId, options?):Promise<APIChannel>
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel to delete
optionsPick<RequestData, 'signal'>YesThe options for deleting the channel
deleteAllMessageReactions(channelId, messageId, options?):Promise<void>
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel the message is in
messageIdSnowflakeNoThe id of the message to delete the reactions for
optionsPick<RequestData, 'signal'>YesThe options for deleting the reactions
deleteAllMessageReactionsForEmoji(channelId, messageId, emoji, options?):Promise<void>
Deletes all reactions of an emoji for a message
Example
// Unicode.
await api.channels.deleteAllMessageReactionsForEmoji('1234567890', '1234567890', '👍');

// Custom emoji.
await api.channels.deleteAllMessageReactionsForEmoji('1234567890', '1234567890', 'emoji_name:1234567890');
// Unicode.
await api.channels.deleteAllMessageReactionsForEmoji('1234567890', '1234567890', '👍');

// Custom emoji.
await api.channels.deleteAllMessageReactionsForEmoji('1234567890', '1234567890', 'emoji_name:1234567890');
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel the message is in
messageIdSnowflakeNoThe id of the message to delete the reactions for
emojistringNoThe emoji to delete the reactions for. URL encoding happens internally
optionsPick<RequestData, 'signal'>YesThe options for deleting the reactions
deleteMessage(channelId, messageId, options?):Promise<void>
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel the message is in
messageIdSnowflakeNoThe id of the message to delete
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for deleting the message
deleteOwnMessageReaction(channelId, messageId, emoji, options?):Promise<void>
Deletes a reaction for the current user
Example
// Unicode.
await api.channels.deleteOwnMessageReaction('1234567890', '1234567890', '👍');

// Custom emoji.
await api.channels.deleteOwnMessageReaction('1234567890', '1234567890', 'emoji_name:1234567890');
// Unicode.
await api.channels.deleteOwnMessageReaction('1234567890', '1234567890', '👍');

// Custom emoji.
await api.channels.deleteOwnMessageReaction('1234567890', '1234567890', 'emoji_name:1234567890');
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel the message is in
messageIdSnowflakeNoThe id of the message to delete the reaction for
emojistringNoThe emoji to delete the reaction for. URL encoding happens internally
optionsPick<RequestData, 'signal'>YesThe options for deleting the reaction
deletePermissionOverwrite(channelId, overwriteId, options?):Promise<void>
Deletes the permission overwrite for a user or role in a channel
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel to delete the permission overwrite in
overwriteIdSnowflakeNoThe id of the user or role to delete the permission overwrite for
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for deleting the permission overwrite
deleteUserMessageReaction(channelId, messageId, emoji, userId, options?):Promise<void>
Deletes a reaction for a user
Example
// Unicode.
await api.channels.deleteUserMessageReaction('1234567890', '1234567890', '👍', '1234567890');

// Custom emoji.
await api.channels.deleteUserMessageReaction('1234567890', '1234567890', 'emoji_name:1234567890', '1234567890');
// Unicode.
await api.channels.deleteUserMessageReaction('1234567890', '1234567890', '👍', '1234567890');

// Custom emoji.
await api.channels.deleteUserMessageReaction('1234567890', '1234567890', 'emoji_name:1234567890', '1234567890');
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel the message is in
messageIdSnowflakeNoThe id of the message to delete the reaction for
emojistringNoThe emoji to delete the reaction for. URL encoding happens internally
userIdSnowflakeNoThe id of the user to delete the reaction for
optionsPick<RequestData, 'signal'>YesThe options for deleting the reaction
edit(channelId, body, options?):Promise<APIChannel>
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel to edit
bodyRESTPatchAPIChannelJSONBodyNoThe new channel data
optionsPick<RequestData, 'signal'>YesThe options for editing the channel
editMessage(channelId, messageId, body, options?):Promise<APIMessage>
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel the message is in
messageIdSnowflakeNoThe id of the message to edit
bodyRESTPatchAPIChannelMessageJSONBody & { files?: RawFile[]; }NoThe data for editing the message
optionsPick<RequestData, 'signal'>YesThe options for editing the message
editPermissionOverwrite(channelId, overwriteId, body, options?):Promise<void>
Edits the permission overwrite for a user or role in a channel
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel to edit the permission overwrite in
overwriteIdSnowflakeNoThe id of the user or role to edit the permission overwrite for
bodyRESTPutAPIChannelPermissionJSONBodyNoThe data for editing the permission overwrite
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for editing the permission overwrite
followAnnouncements(channelId, webhookChannelId, options?):Promise<APIFollowedChannel>
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the announcement channel to follow
webhookChannelIdSnowflakeNoThe id of the webhook channel to follow the announcements in
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for following the announcement channel
get(channelId, options?):Promise<APIChannel>
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel
optionsPick<RequestData, 'signal'>YesThe options for fetching the channel
getArchivedThreads(channelId, archivedStatus, query?, options?):Promise<RESTGetAPIChannelUsersThreadsArchivedResult>
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel to fetch archived threads from
archivedStatus'private' | 'public'NoThe archived status of the threads to fetch
queryRESTGetAPIChannelThreadsArchivedQueryYesThe options for fetching archived threads
optionsPick<RequestData, 'signal'>YesThe options for fetching archived threads
getInvites(channelId, options?):Promise<RESTGetAPIChannelInvitesResult>
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel to fetch invites from
optionsPick<RequestData, 'signal'>YesThe options for fetching the invites
getJoinedPrivateArchivedThreads(channelId, query?, options?):Promise<RESTGetAPIChannelUsersThreadsArchivedResult>
Fetches the private joined archived threads of a channel
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel to fetch joined archived threads from
queryRESTGetAPIChannelThreadsArchivedQueryYesThe options for fetching joined archived threads
optionsPick<RequestData, 'signal'>YesThe options for fetching joined archived threads
getMessage(channelId, messageId, options?):Promise<APIMessage>
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel the message is in
messageIdSnowflakeNoThe id of the message to fetch
optionsPick<RequestData, 'signal'>YesThe options for fetching the message
getMessageReactions(channelId, messageId, emoji, query?, options?):Promise<RESTGetAPIChannelMessageReactionUsersResult>
Fetches the reactions for a message
Example
// Unicode.
await api.channels.getMessageReactions('1234567890', '1234567890', '👍');

// Custom emoji.
await api.channels.getMessageReactions('1234567890', '1234567890', 'emoji_name:1234567890');
// Unicode.
await api.channels.getMessageReactions('1234567890', '1234567890', '👍');

// Custom emoji.
await api.channels.getMessageReactions('1234567890', '1234567890', 'emoji_name:1234567890');
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel the message is in
messageIdSnowflakeNoThe id of the message to get the reactions for
emojistringNoThe emoji to get the reactions for. URL encoding happens internally
queryRESTGetAPIChannelMessageReactionUsersQueryYesThe query options for fetching the reactions
optionsPick<RequestData, 'signal'>YesThe options for fetching the message reactions
getMessages(channelId, query?, options?):Promise<RESTGetAPIChannelMessagesResult>
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel to fetch messages from
queryRESTGetAPIChannelMessagesQueryYesThe query options for fetching messages
optionsPick<RequestData, 'signal'>YesThe options for fetching the messages
getPins(channelId, options?):Promise<RESTGetAPIChannelPinsResult>
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel to fetch pinned messages from
optionsPick<RequestData, 'signal'>YesThe options for fetching the pinned messages
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel
pinMessage(channelId, messageId, options?):Promise<void>
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel to pin the message in
messageIdSnowflakeNoThe id of the message to pin
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for pinning the message
sendSoundboardSound(channelId, body, options?):Promise<APISoundboardSound>
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel to send the soundboard sound in
bodyRESTPostAPISoundboardSendSoundJSONBodyNoThe data for sending the soundboard sound
optionsPick<RequestData, 'signal'>YesThe options for sending the soundboard sound
showTyping(channelId, options?):Promise<void>
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel to show the typing indicator in
optionsPick<RequestData, 'signal'>YesThe options for showing the typing indicator
unpinMessage(channelId, messageId, options?):Promise<void>
NameTypeOptionalDescription
channelIdSnowflakeNoThe id of the channel to unpin the message in
messageIdSnowflakeNoThe id of the message to unpin
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for unpinning the message