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
channelIdSnowflakeNo
The id of the channel the message is in
messageIdSnowflakeNo
The id of the message to add the reaction to
emojistringNo
The emoji to add the reaction with. URL encoding happens internally
optionsPick<RequestData, 'auth' | 'signal'>Yes
The options for adding the reaction
bulkDeleteMessages(channelId, messageIds, options?):Promise<void>
NameTypeOptionalDescription
channelIdSnowflakeNo
The id of the channel the messages are in
messageIdsSnowflake[]No
The ids of the messages to delete
optionsPick<RequestData, 'auth' | 'reason' | 'signal'>Yes
The options for deleting the messages
createForumThread(channelId, body, options?):Promise<APIThreadChannel>
NameTypeOptionalDescription
channelIdSnowflakeNo
The id of the forum channel to start the thread in
bodyStartForumThreadOptionsNo
The data for starting the thread
optionsPick<RequestData, 'auth' | 'signal'>Yes
The options for starting the thread
createInvite(channelId, body, options?):Promise<APIExtendedInvite>
NameTypeOptionalDescription
channelIdSnowflakeNo
The id of the channel to create an invite for
bodyRESTPostAPIChannelInviteJSONBodyNo
The data for creating the invite
optionsPick<RequestData, 'auth' | 'reason' | 'signal'>Yes
The options for creating the invite
createMessage(channelId, body, options?):Promise<APIMessage>
NameTypeOptionalDescription
channelIdSnowflakeNo
The id of the channel to send the message in
bodyCreateMessageOptionsNo
The data for sending the message
optionsPick<RequestData, 'auth' | 'signal'>Yes
The options for sending the message
createThread(channelId, body, messageId?, options?):Promise<APIChannel>
NameTypeOptionalDescription
channelIdSnowflakeNo
The id of the channel to start the thread in
bodyRESTPostAPIChannelThreadsJSONBodyNo
The data for starting the thread
messageIdSnowflakeYes
The id of the message to start the thread from
optionsPick<RequestData, 'auth' | 'signal'>Yes
The options for starting the thread
createWebhook(channelId, body, options?):Promise<APIWebhook>
NameTypeOptionalDescription
channelIdSnowflakeNo
The id of the channel to create the webhook in
bodyRESTPostAPIChannelWebhookJSONBodyNo
The data for creating the webhook
optionsPick<RequestData, 'auth' | 'reason' | 'signal'>Yes
The options for creating the webhook
crosspostMessage(channelId, messageId, options?):Promise<APIMessage>
NameTypeOptionalDescription
channelIdSnowflakeNo
The id of the channel the message is in
messageIdSnowflakeNo
The id of the message to crosspost
optionsPick<RequestData, 'auth' | 'signal'>Yes
The options for crossposting the message
delete(channelId, options?):Promise<APIChannel>
NameTypeOptionalDescription
channelIdSnowflakeNo
The id of the channel to delete
optionsPick<RequestData, 'auth' | 'signal'>Yes
The options for deleting the channel
deleteAllMessageReactions(channelId, messageId, options?):Promise<void>
NameTypeOptionalDescription
channelIdSnowflakeNo
The id of the channel the message is in
messageIdSnowflakeNo
The id of the message to delete the reactions for
optionsPick<RequestData, 'auth' | 'signal'>Yes
The 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
channelIdSnowflakeNo
The id of the channel the message is in
messageIdSnowflakeNo
The id of the message to delete the reactions for
emojistringNo
The emoji to delete the reactions for. URL encoding happens internally
optionsPick<RequestData, 'auth' | 'signal'>Yes
The options for deleting the reactions
deleteMessage(channelId, messageId, options?):Promise<void>
NameTypeOptionalDescription
channelIdSnowflakeNo
The id of the channel the message is in
messageIdSnowflakeNo
The id of the message to delete
optionsPick<RequestData, 'auth' | 'reason' | 'signal'>Yes
The 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
channelIdSnowflakeNo
The id of the channel the message is in
messageIdSnowflakeNo
The id of the message to delete the reaction for
emojistringNo
The emoji to delete the reaction for. URL encoding happens internally
optionsPick<RequestData, 'auth' | 'signal'>Yes
The options for deleting the reaction
deletePermissionOverwrite(channelId, overwriteId, options?):Promise<void>
Deletes the permission overwrite for a user or role in a channel
NameTypeOptionalDescription
channelIdSnowflakeNo
The id of the channel to delete the permission overwrite in
overwriteIdSnowflakeNo
The id of the user or role to delete the permission overwrite for
optionsPick<RequestData, 'auth' | 'reason' | 'signal'>Yes
The 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
channelIdSnowflakeNo
The id of the channel the message is in
messageIdSnowflakeNo
The id of the message to delete the reaction for
emojistringNo
The emoji to delete the reaction for. URL encoding happens internally
userIdSnowflakeNo
The id of the user to delete the reaction for
optionsPick<RequestData, 'auth' | 'signal'>Yes
The options for deleting the reaction
edit(channelId, body, options?):Promise<APIChannel>
NameTypeOptionalDescription
channelIdSnowflakeNo
The id of the channel to edit
bodyRESTPatchAPIChannelJSONBodyNo
The new channel data
optionsPick<RequestData, 'auth' | 'signal'>Yes
The options for editing the channel
editMessage(channelId, messageId, body, options?):Promise<APIMessage>
NameTypeOptionalDescription
channelIdSnowflakeNo
The id of the channel the message is in
messageIdSnowflakeNo
The id of the message to edit
bodyEditMessageOptionsNo
The data for editing the message
optionsPick<RequestData, 'auth' | 'signal'>Yes
The 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
channelIdSnowflakeNo
The id of the channel to edit the permission overwrite in
overwriteIdSnowflakeNo
The id of the user or role to edit the permission overwrite for
bodyRESTPutAPIChannelPermissionJSONBodyNo
The data for editing the permission overwrite
optionsPick<RequestData, 'auth' | 'reason' | 'signal'>Yes
The options for editing the permission overwrite
followAnnouncements(channelId, webhookChannelId, options?):Promise<APIFollowedChannel>
NameTypeOptionalDescription
channelIdSnowflakeNo
The id of the announcement channel to follow
webhookChannelIdSnowflakeNo
The id of the webhook channel to follow the announcements in
optionsPick<RequestData, 'auth' | 'reason' | 'signal'>Yes
The options for following the announcement channel
get(channelId, options?):Promise<APIChannel>
NameTypeOptionalDescription
channelIdSnowflakeNo
The id of the channel
optionsPick<RequestData, 'auth' | 'signal'>Yes
The options for fetching the channel
getArchivedThreads(channelId, archivedStatus, query?, options?):Promise<RESTGetAPIChannelUsersThreadsArchivedResult>
NameTypeOptionalDescription
channelIdSnowflakeNo
The id of the channel to fetch archived threads from
archivedStatus'private' | 'public'No
The archived status of the threads to fetch
queryRESTGetAPIChannelThreadsArchivedQueryYes
The options for fetching archived threads
optionsPick<RequestData, 'auth' | 'signal'>Yes
The options for fetching archived threads
getInvites(channelId, options?):Promise<RESTGetAPIChannelInvitesResult>
NameTypeOptionalDescription
channelIdSnowflakeNo
The id of the channel to fetch invites from
optionsPick<RequestData, 'auth' | 'signal'>Yes
The options for fetching the invites
getJoinedPrivateArchivedThreads(channelId, query?, options?):Promise<RESTGetAPIChannelUsersThreadsArchivedResult>
Fetches the private joined archived threads of a channel
NameTypeOptionalDescription
channelIdSnowflakeNo
The id of the channel to fetch joined archived threads from
queryRESTGetAPIChannelThreadsArchivedQueryYes
The options for fetching joined archived threads
optionsPick<RequestData, 'auth' | 'signal'>Yes
The options for fetching joined archived threads
getMessage(channelId, messageId, options?):Promise<APIMessage>
NameTypeOptionalDescription
channelIdSnowflakeNo
The id of the channel the message is in
messageIdSnowflakeNo
The id of the message to fetch
optionsPick<RequestData, 'auth' | 'signal'>Yes
The 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
channelIdSnowflakeNo
The id of the channel the message is in
messageIdSnowflakeNo
The id of the message to get the reactions for
emojistringNo
The emoji to get the reactions for. URL encoding happens internally
queryRESTGetAPIChannelMessageReactionUsersQueryYes
The query options for fetching the reactions
optionsPick<RequestData, 'auth' | 'signal'>Yes
The options for fetching the message reactions
getMessages(channelId, query?, options?):Promise<RESTGetAPIChannelMessagesResult>
NameTypeOptionalDescription
channelIdSnowflakeNo
The id of the channel to fetch messages from
queryRESTGetAPIChannelMessagesQueryYes
The query options for fetching messages
optionsPick<RequestData, 'auth' | 'signal'>Yes
The options for fetching the messages
getPins(channelId, options?):Promise<RESTGetAPIChannelPinsResult>
NameTypeOptionalDescription
channelIdSnowflakeNo
The id of the channel to fetch pinned messages from
optionsPick<RequestData, 'auth' | 'signal'>Yes
The options for fetching the pinned messages
getWebhooks(channelId, options?):Promise<RESTGetAPIChannelWebhooksResult>
NameTypeOptionalDescription
channelIdSnowflakeNo
The id of the channel
optionsPick<RequestData, 'auth' | 'signal'>Yes
The options for fetching the webhooks
pinMessage(channelId, messageId, options?):Promise<void>
NameTypeOptionalDescription
channelIdSnowflakeNo
The id of the channel to pin the message in
messageIdSnowflakeNo
The id of the message to pin
optionsPick<RequestData, 'auth' | 'reason' | 'signal'>Yes
The options for pinning the message
sendSoundboardSound(channelId, body, options?):Promise<APISoundboardSound>
NameTypeOptionalDescription
channelIdSnowflakeNo
The id of the channel to send the soundboard sound in
bodyRESTPostAPISoundboardSendSoundJSONBodyNo
The data for sending the soundboard sound
optionsPick<RequestData, 'auth' | 'signal'>Yes
The options for sending the soundboard sound
showTyping(channelId, options?):Promise<void>
NameTypeOptionalDescription
channelIdSnowflakeNo
The id of the channel to show the typing indicator in
optionsPick<RequestData, 'auth' | 'signal'>Yes
The options for showing the typing indicator
unpinMessage(channelId, messageId, options?):Promise<void>
NameTypeOptionalDescription
channelIdSnowflakeNo
The id of the channel to unpin the message in
messageIdSnowflakeNo
The id of the message to unpin
optionsPick<RequestData, 'auth' | 'reason' | 'signal'>Yes
The options for unpinning the message