diff --git a/packages/core/src/api/applicationCommands.ts b/packages/core/src/api/applicationCommands.ts index a1083ceb0..29fde7cea 100644 --- a/packages/core/src/api/applicationCommands.ts +++ b/packages/core/src/api/applicationCommands.ts @@ -36,8 +36,8 @@ export class ApplicationCommandsAPI { * * @see {@link https://discord.com/developers/docs/interactions/application-commands#get-global-application-commands} * @param applicationId - The application id to fetch commands for - * @param query - The query options to use when fetching commands - * @param options - The options to use when fetching commands + * @param query - The query options for fetching commands + * @param options - The options for fetching commands */ public async getGlobalCommands( applicationId: Snowflake, @@ -55,8 +55,8 @@ export class ApplicationCommandsAPI { * * @see {@link https://discord.com/developers/docs/interactions/application-commands#create-global-application-command} * @param applicationId - The application id to create the command for - * @param body - The data to use when creating the command - * @param options - The options to use when creating the command + * @param body - The data for creating the command + * @param options - The options for creating the command */ public async createGlobalCommand( applicationId: Snowflake, @@ -75,7 +75,7 @@ export class ApplicationCommandsAPI { * @see {@link https://discord.com/developers/docs/interactions/application-commands#get-global-application-command} * @param applicationId - The application id to fetch the command from * @param commandId - The command id to fetch - * @param options - The options to use when fetching the command + * @param options - The options for fetching the command */ public async getGlobalCommand( applicationId: Snowflake, @@ -93,7 +93,7 @@ export class ApplicationCommandsAPI { * @see {@link https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command} * @param applicationId - The application id of the command * @param commandId - The id of the command to edit - * @param body - The data to use when editing the command + * @param body - The data for editing the command * @param options - The options for editing the command */ public async editGlobalCommand( @@ -129,7 +129,7 @@ export class ApplicationCommandsAPI { * * @see {@link https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands} * @param applicationId - The application id to overwrite commands for - * @param body - The data to use when overwriting commands + * @param body - The data for overwriting commands * @param options - The options for overwriting commands */ public async bulkOverwriteGlobalCommands( @@ -149,8 +149,8 @@ export class ApplicationCommandsAPI { * @see {@link https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands} * @param applicationId - The application id to fetch commands for * @param guildId - The guild id to fetch commands for - * @param query - The data to use when fetching commands - * @param options - The options to use when fetching commands + * @param query - The data for fetching commands + * @param options - The options for fetching commands */ public async getGuildCommands( applicationId: Snowflake, @@ -170,8 +170,8 @@ export class ApplicationCommandsAPI { * @see {@link https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command} * @param applicationId - The application id to create the command for * @param guildId - The guild id to create the command for - * @param body - The data to use when creating the command - * @param options - The options to use when creating the command + * @param body - The data for creating the command + * @param options - The options for creating the command */ public async createGuildCommand( applicationId: Snowflake, @@ -192,7 +192,7 @@ export class ApplicationCommandsAPI { * @param applicationId - The application id to fetch the command from * @param guildId - The guild id to fetch the command from * @param commandId - The command id to fetch - * @param options - The options to use when fetching the command + * @param options - The options for fetching the command */ public async getGuildCommand( applicationId: Snowflake, @@ -212,8 +212,8 @@ export class ApplicationCommandsAPI { * @param applicationId - The application id of the command * @param guildId - The guild id of the command * @param commandId - The command id to edit - * @param body - The data to use when editing the command - * @param options - The options to use when editing the command + * @param body - The data for editing the command + * @param options - The options for editing the command */ public async editGuildCommand( applicationId: Snowflake, @@ -252,8 +252,8 @@ export class ApplicationCommandsAPI { * @see {@link https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands} * @param applicationId - The application id to overwrite commands for * @param guildId - The guild id to overwrite commands for - * @param body - The data to use when overwriting commands - * @param options - The options to use when overwriting the commands + * @param body - The data for overwriting commands + * @param options - The options for overwriting the commands */ public async bulkOverwriteGuildCommands( applicationId: Snowflake, @@ -313,8 +313,8 @@ export class ApplicationCommandsAPI { * @param applicationId - The application id to edit the permissions for * @param guildId - The guild id to edit the permissions for * @param commandId - The id of the command to edit the permissions for - * @param body - The data to use when editing the permissions - * @param options - The options to use when editing the permissions + * @param body - The data for editing the permissions + * @param options - The options for editing the permissions */ public async editGuildCommandPermissions( userToken: string, diff --git a/packages/core/src/api/channel.ts b/packages/core/src/api/channel.ts index 99b5a9a51..b4f66756a 100644 --- a/packages/core/src/api/channel.ts +++ b/packages/core/src/api/channel.ts @@ -3,6 +3,8 @@ import { makeURLSearchParams, type RawFile, type REST, type RequestData } from '@discordjs/rest'; import { Routes, + type RESTPostAPIChannelWebhookJSONBody, + type RESTPostAPIChannelWebhookResult, type RESTDeleteAPIChannelResult, type RESTGetAPIChannelInvitesResult, type RESTGetAPIChannelMessageReactionUsersQuery, @@ -26,8 +28,16 @@ import { type RESTPostAPIChannelMessageJSONBody, type RESTPostAPIChannelMessageResult, type Snowflake, + type RESTPostAPIChannelThreadsJSONBody, + type RESTPostAPIChannelThreadsResult, + type APIThreadChannel, + type RESTPostAPIGuildForumThreadsJSONBody, } from 'discord-api-types/v10'; +export interface StartForumThreadOptions extends RESTPostAPIGuildForumThreadsJSONBody { + message: RESTPostAPIGuildForumThreadsJSONBody['message'] & { files?: RawFile[] }; +} + export class ChannelsAPI { public constructor(private readonly rest: REST) {} @@ -36,8 +46,8 @@ export class ChannelsAPI { * * @see {@link https://discord.com/developers/docs/resources/channel#create-message} * @param channelId - The id of the channel to send the message in - * @param body - The data to use when sending the message - * @param options - The options to use when sending the message + * @param body - The data for sending the message + * @param options - The options for sending the message */ public async createMessage( channelId: Snowflake, @@ -57,8 +67,8 @@ export class ChannelsAPI { * @see {@link https://discord.com/developers/docs/resources/channel#edit-message} * @param channelId - The id of the channel the message is in * @param messageId - The id of the message to edit - * @param body - The data to use when editing the message - * @param options - The options to use when editing the message + * @param body - The data for editing the message + * @param options - The options for editing the message */ public async editMessage( channelId: Snowflake, @@ -80,7 +90,7 @@ export class ChannelsAPI { * @param channelId - The id of the channel the message is in * @param messageId - The id of the message to get the reactions for * @param emoji - The emoji to get the reactions for - * @param query - The query options to use when fetching the reactions + * @param query - The query options for fetching the reactions * @param options - The options for fetching the message reactions */ public async getMessageReactions( @@ -233,7 +243,7 @@ export class ChannelsAPI { * * @see {@link https://discord.com/developers/docs/resources/channel#get-channel-messages} * @param channelId - The id of the channel to fetch messages from - * @param query - The query options to use when fetching messages + * @param query - The query options for fetching messages * @param options - The options for fetching the messages */ public async getMessages( @@ -389,7 +399,7 @@ export class ChannelsAPI { * * @see {@link https://discord.com/developers/docs/resources/channel#create-channel-invite} * @param channelId - The id of the channel to create an invite for - * @param body - The data to use when creating the invite + * @param body - The data for creating the invite * @param options - The options for creating the invite */ public async createInvite( @@ -415,6 +425,51 @@ export class ChannelsAPI { return this.rest.get(Routes.channelInvites(channelId), { signal }) as Promise; } + /** + * Creates a new thread + * + * @see {@link https://discord.com/developers/docs/resources/channel#start-thread-from-message} + * @see {@link https://discord.com/developers/docs/resources/channel#start-thread-without-message} + * @param channelId - The id of the channel to start the thread in + * @param body - The data for starting the thread + * @param messageId - The id of the message to start the thread from + * @param options - The options for starting the thread + */ + public async createThread( + channelId: Snowflake, + body: RESTPostAPIChannelThreadsJSONBody, + messageId?: Snowflake, + { signal }: Pick = {}, + ) { + return this.rest.post(Routes.threads(channelId, messageId), { + body, + signal, + }) as Promise; + } + + /** + * Creates a new forum post + * + * @see {@link https://discord.com/developers/docs/resources/channel#start-thread-in-forum-channel} + * @param channelId - The id of the forum channel to start the thread in + * @param body - The data for starting the thread + * @param options - The options for starting the thread + */ + public async createForumThread( + channelId: Snowflake, + { message, ...optionsBody }: StartForumThreadOptions, + { signal }: Pick = {}, + ) { + const { files, ...messageBody } = message; + + const body = { + ...optionsBody, + message: messageBody, + }; + + return this.rest.post(Routes.threads(channelId), { files, body, signal }) as Promise; + } + /** * Fetches the archived threads of a channel * @@ -422,7 +477,7 @@ export class ChannelsAPI { * @see {@link https://discord.com/developers/docs/resources/channel#list-private-archived-threads} * @param channelId - The id of the channel to fetch archived threads from * @param archivedStatus - The archived status of the threads to fetch - * @param query - The options to use when fetching archived threads + * @param query - The options for fetching archived threads * @param options - The options for fetching archived threads */ public async getArchivedThreads( @@ -442,7 +497,7 @@ export class ChannelsAPI { * * @see {@link https://discord.com/developers/docs/resources/channel#list-joined-private-archived-threads} * @param channelId - The id of the channel to fetch joined archived threads from - * @param query - The options to use when fetching joined archived threads + * @param query - The options for fetching joined archived threads * @param options - The options for fetching joined archived threads */ public async getJoinedPrivateArchivedThreads( @@ -456,13 +511,33 @@ export class ChannelsAPI { }) as Promise; } + /** + * Creates a new webhook + * + * @see {@link https://discord.com/developers/docs/resources/webhook#create-webhook} + * @param channelId - The id of the channel to create the webhook in + * @param body - The data for creating the webhook + * @param options - The options for creating the webhook + */ + public async createWebhook( + channelId: Snowflake, + body: RESTPostAPIChannelWebhookJSONBody, + { reason, signal }: Pick = {}, + ) { + return this.rest.post(Routes.channelWebhooks(channelId), { + reason, + body, + signal, + }) as Promise; + } + /** * Fetches the webhooks of a channel * * @see {@link https://discord.com/developers/docs/resources/webhook#get-channel-webhooks} - * @param id - The id of the channel + * @param channelId - The id of the channel */ - public async getWebhooks(id: Snowflake) { - return this.rest.get(Routes.channelWebhooks(id)) as Promise; + public async getWebhooks(channelId: Snowflake) { + return this.rest.get(Routes.channelWebhooks(channelId)) as Promise; } } diff --git a/packages/core/src/api/guild.ts b/packages/core/src/api/guild.ts index 2f74b3caf..13ee1c8a9 100644 --- a/packages/core/src/api/guild.ts +++ b/packages/core/src/api/guild.ts @@ -169,7 +169,7 @@ export class GuildsAPI { * * @see {@link https://discord.com/developers/docs/resources/guild#list-guild-members} * @param guildId - The id of the guild - * @param query - The query to use when fetching the guild members + * @param query - The query for fetching the guild members * @param options - The options for fetching the guild members */ public async getMembers( @@ -1112,7 +1112,7 @@ export class GuildsAPI { * @see {@link https://discord.com/developers/docs/resources/guild#modify-guild-member} * @param guildId - The id of the guild * @param userId - The id of the user - * @param body - The data to use when editing the guild member + * @param body - The data for editing the guild member * @param options - The options for editing the guild member */ public async editMember( @@ -1196,7 +1196,7 @@ export class GuildsAPI { * * @see {@link https://discord.com/developers/docs/resources/guild-template#create-guild-template} * @param templateCode - The code of the template - * @param body - The data to use when creating the template + * @param body - The data for creating the template * @param options - The options for creating the template */ public async createTemplate( @@ -1222,7 +1222,7 @@ export class GuildsAPI { * * @see {@link https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state} * @param guildId - The id of the guild - * @param body - The options to use when setting the voice state + * @param body - The options for setting the voice state */ public async setVoiceState(guildId: Snowflake, body: RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody = {}) { return this.rest.patch(Routes.guildVoiceState(guildId, '@me'), { diff --git a/packages/core/src/api/interactions.ts b/packages/core/src/api/interactions.ts index 21a5066f9..5cd4908b8 100644 --- a/packages/core/src/api/interactions.ts +++ b/packages/core/src/api/interactions.ts @@ -21,8 +21,8 @@ export class InteractionsAPI { * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response} * @param interactionId - The id of the interaction * @param interactionToken - The token of the interaction - * @param body - The callback data to use when replying - * @param options - The options to use when replying + * @param body - The callback data for replying + * @param options - The options for replying */ public async reply( interactionId: Snowflake, @@ -47,8 +47,8 @@ export class InteractionsAPI { * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response} * @param interactionId - The id of the interaction * @param interactionToken - The token of the interaction - * @param data - The data to use when deferring the reply - * @param options - The options to use when deferring + * @param data - The data for deferring the reply + * @param options - The options for deferring */ public async defer( interactionId: Snowflake, @@ -72,7 +72,7 @@ export class InteractionsAPI { * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response} * @param interactionId - The id of the interaction * @param interactionToken - The token of the interaction - * @param options - The options to use when deferring + * @param options - The options for deferring */ public async deferMessageUpdate( interactionId: Snowflake, @@ -94,8 +94,8 @@ export class InteractionsAPI { * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message} * @param applicationId - The application id of the interaction * @param interactionToken - The token of the interaction - * @param body - The callback data to use when replying - * @param options - The options to use when replying + * @param body - The callback data for replying + * @param options - The options for replying */ public async followUp( applicationId: Snowflake, @@ -113,9 +113,9 @@ export class InteractionsAPI { * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message} * @param applicationId - The application id of the interaction * @param interactionToken - The token of the interaction - * @param callbackData - The callback data to use when editing the reply + * @param callbackData - The callback data for editing the reply * @param messageId - The id of the message to edit. If omitted, the original reply will be edited - * @param options - The options to use when editing the reply + * @param options - The options for editing the reply */ public async editReply( applicationId: Snowflake, @@ -135,7 +135,7 @@ export class InteractionsAPI { * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#get-original-interaction-response} * @param applicationId - The application id of the interaction * @param interactionToken - The token of the interaction - * @param options - The options to use when fetching the reply + * @param options - The options for fetching the reply */ public async getOriginalReply( applicationId: Snowflake, @@ -159,7 +159,7 @@ export class InteractionsAPI { * @param applicationId - The application id of the interaction * @param interactionToken - The token of the interaction * @param messageId - The id of the message to delete. If omitted, the original reply will be deleted - * @param options - The options to use when deleting the reply + * @param options - The options for deleting the reply */ public async deleteReply( applicationId: Snowflake, @@ -176,8 +176,8 @@ export class InteractionsAPI { * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response} * @param interactionId - The id of the interaction * @param interactionToken - The token of the interaction - * @param callbackData - The callback data to use when updating the interaction - * @param options - The options to use when updating the interaction + * @param callbackData - The callback data for updating the interaction + * @param options - The options for updating the interaction */ public async updateMessage( interactionId: Snowflake, @@ -203,7 +203,7 @@ export class InteractionsAPI { * @param interactionId - The id of the interaction * @param interactionToken - The token of the interaction * @param callbackData - The callback data for the autocomplete response - * @param options - The options to use when sending the autocomplete response + * @param options - The options for sending the autocomplete response */ public async createAutocompleteResponse( interactionId: Snowflake, @@ -228,7 +228,7 @@ export class InteractionsAPI { * @param interactionId - The id of the interaction * @param interactionToken - The token of the interaction * @param callbackData - The modal callback data to send - * @param options - The options to use when sending the modal + * @param options - The options for sending the modal */ public async createModal( interactionId: Snowflake, diff --git a/packages/core/src/api/invite.ts b/packages/core/src/api/invite.ts index 39ce1a9b2..d29eaa7b0 100644 --- a/packages/core/src/api/invite.ts +++ b/packages/core/src/api/invite.ts @@ -11,8 +11,8 @@ export class InvitesAPI { * * @see {@link https://discord.com/developers/docs/resources/invite#get-invite} * @param code - The invite code - * @param query - The options to use when fetching the invite - * @param options - The options to use when fetching the invite + * @param query - The options for fetching the invite + * @param options - The options for fetching the invite */ public async get(code: string, query: RESTGetAPIInviteQuery = {}, { signal }: Pick = {}) { return this.rest.get(Routes.invite(code), { @@ -26,7 +26,7 @@ export class InvitesAPI { * * @see {@link https://discord.com/developers/docs/resources/invite#delete-invite} * @param code - The invite code - * @param options - The options to use when deleting the invite + * @param options - The options for deleting the invite */ public async delete(code: string, { reason, signal }: Pick = {}) { await this.rest.delete(Routes.invite(code), { reason, signal }); diff --git a/packages/core/src/api/roleConnections.ts b/packages/core/src/api/roleConnections.ts index 065444aa6..c77a83995 100644 --- a/packages/core/src/api/roleConnections.ts +++ b/packages/core/src/api/roleConnections.ts @@ -17,7 +17,7 @@ export class RoleConnectionsAPI { * * @see {@link https://discord.com/developers/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records} * @param applicationId - The id of the application to get role connection metadata records for - * @param options - The options to use when fetching the role connection metadata records + * @param options - The options for fetching the role connection metadata records */ public async getMetadataRecords(applicationId: Snowflake, { signal }: Pick = {}) { return this.rest.get(Routes.applicationRoleConnectionMetadata(applicationId), { @@ -31,7 +31,7 @@ export class RoleConnectionsAPI { * @see {@link https://discord.com/developers/docs/resources/application-role-connection-metadata#update-application-role-connection-metadata-records} * @param applicationId - The id of the application to update role connection metadata records for * @param body - The new role connection metadata records - * @param options - The options to use when updating the role connection metadata records + * @param options - The options for updating the role connection metadata records */ public async updateMetadataRecords( applicationId: Snowflake, diff --git a/packages/core/src/api/stageInstances.ts b/packages/core/src/api/stageInstances.ts index a43df7fc9..c1a61f357 100644 --- a/packages/core/src/api/stageInstances.ts +++ b/packages/core/src/api/stageInstances.ts @@ -18,7 +18,7 @@ export class StageInstancesAPI { * Creates a new stage instance * * @see {@link https://discord.com/developers/docs/resources/stage-instance#get-stage-instance} - * @param body - The data to use when creating the new stage instance + * @param body - The data for creating the new stage instance * @param options - The options for creating the new stage instance */ public async create( diff --git a/packages/core/src/api/sticker.ts b/packages/core/src/api/sticker.ts index fa53428bd..66e7383b1 100644 --- a/packages/core/src/api/sticker.ts +++ b/packages/core/src/api/sticker.ts @@ -15,7 +15,7 @@ export class StickersAPI { * Fetches all of the nitro sticker packs * * @see {@link https://discord.com/developers/docs/resources/sticker#list-nitro-sticker-packs} - * @param options - The options to use when fetching the sticker packs + * @param options - The options for fetching the sticker packs */ public async getNitroStickers({ signal }: Pick = {}) { return this.rest.get(Routes.nitroStickerPacks(), { signal }) as Promise; @@ -26,7 +26,7 @@ export class StickersAPI { * * @see {@link https://discord.com/developers/docs/resources/sticker#get-sticker} * @param stickerId - The id of the sticker - * @param options - The options to use when fetching the sticker + * @param options - The options for fetching the sticker */ public async get(stickerId: Snowflake, { signal }: Pick = {}) { return this.rest.get(Routes.sticker(stickerId), { signal }) as Promise; diff --git a/packages/core/src/api/thread.ts b/packages/core/src/api/thread.ts index c9dd00141..62022ba00 100644 --- a/packages/core/src/api/thread.ts +++ b/packages/core/src/api/thread.ts @@ -1,86 +1,22 @@ /* eslint-disable jsdoc/check-param-names */ -import type { RawFile, RequestData, REST } from '@discordjs/rest'; +import type { RequestData, REST } from '@discordjs/rest'; import { Routes, - type APIThreadChannel, type APIThreadMember, type RESTGetAPIChannelThreadMembersResult, - type RESTPostAPIChannelThreadsJSONBody, - type RESTPostAPIChannelThreadsResult, - type RESTPostAPIGuildForumThreadsJSONBody, type Snowflake, } from 'discord-api-types/v10'; -export interface StartForumThreadOptions extends RESTPostAPIGuildForumThreadsJSONBody { - message: RESTPostAPIGuildForumThreadsJSONBody['message'] & { files?: RawFile[] }; -} - export class ThreadsAPI { public constructor(private readonly rest: REST) {} - /** - * Fetches a thread - * - * @see {@link https://discord.com/developers/docs/resources/channel#get-channel} - * @param threadId - The id of the thread - * @param options - The options to use when fetching the thread - */ - public async get(threadId: Snowflake, { signal }: Pick = {}) { - return this.rest.get(Routes.channel(threadId), { signal }) as Promise; - } - - /** - * Creates a new thread - * - * @see {@link https://discord.com/developers/docs/resources/channel#start-thread-from-message} - * @see {@link https://discord.com/developers/docs/resources/channel#start-thread-without-message} - * @param channelId - The id of the channel to start the thread in - * @param body - The data to use when starting the thread - * @param messageId - The id of the message to start the thread from - * @param options - The options to use when starting the thread - */ - public async create( - channelId: Snowflake, - body: RESTPostAPIChannelThreadsJSONBody, - messageId?: Snowflake, - { signal }: Pick = {}, - ) { - return this.rest.post(Routes.threads(channelId, messageId), { - body, - signal, - }) as Promise; - } - - /** - * Creates a new forum post - * - * @see {@link https://discord.com/developers/docs/resources/channel#start-thread-in-forum-channel} - * @param channelId - The id of the forum channel to start the thread in - * @param body - The data to use when starting the thread - * @param options - The options to use when starting the thread - */ - public async createForumThread( - channelId: Snowflake, - { message, ...optionsBody }: StartForumThreadOptions, - { signal }: Pick = {}, - ) { - const { files, ...messageBody } = message; - - const body = { - ...optionsBody, - message: messageBody, - }; - - return this.rest.post(Routes.threads(channelId), { files, body, signal }) as Promise; - } - /** * Adds the current user to a thread * * @see {@link https://discord.com/developers/docs/resources/channel#join-thread} * @param threadId - The id of the thread to join - * @param options - The options to use when joining the thread + * @param options - The options for joining the thread */ public async join(threadId: Snowflake, { signal }: Pick = {}) { await this.rest.put(Routes.threadMembers(threadId, '@me'), { signal }); @@ -92,7 +28,7 @@ export class ThreadsAPI { * @see {@link https://discord.com/developers/docs/resources/channel#add-thread-member} * @param threadId - The id of the thread to add the member to * @param userId - The id of the user to add to the thread - * @param options - The options to use when adding the member to the thread + * @param options - The options for adding the member to the thread */ public async addMember(threadId: Snowflake, userId: Snowflake, { signal }: Pick = {}) { await this.rest.put(Routes.threadMembers(threadId, userId), { signal }); @@ -103,7 +39,7 @@ export class ThreadsAPI { * * @see {@link https://discord.com/developers/docs/resources/channel#leave-thread} * @param threadId - The id of the thread to leave - * @param options - The options to use when leaving the thread + * @param options - The options for leaving the thread */ public async leave(threadId: Snowflake, { signal }: Pick = {}) { await this.rest.delete(Routes.threadMembers(threadId, '@me'), { signal }); @@ -115,7 +51,7 @@ export class ThreadsAPI { * @see {@link https://discord.com/developers/docs/resources/channel#remove-thread-member} * @param threadId - The id of the thread to remove the member from * @param userId - The id of the user to remove from the thread - * @param options - The options to use when removing the member from the thread + * @param options - The options for removing the member from the thread */ public async removeMember(threadId: Snowflake, userId: Snowflake, { signal }: Pick = {}) { await this.rest.delete(Routes.threadMembers(threadId, userId), { signal }); @@ -127,7 +63,7 @@ export class ThreadsAPI { * @see {@link https://discord.com/developers/docs/resources/channel#get-thread-member} * @param threadId - The id of the thread to fetch the member from * @param userId - The id of the user - * @param options - The options to use when fetching the member + * @param options - The options for fetching the member */ public async getMember(threadId: Snowflake, userId: Snowflake, { signal }: Pick = {}) { return this.rest.get(Routes.threadMembers(threadId, userId), { signal }) as Promise; @@ -138,7 +74,7 @@ export class ThreadsAPI { * * @see {@link https://discord.com/developers/docs/resources/channel#list-thread-members} * @param threadId - The id of the thread to fetch the members from - * @param options - The options to use when fetching the members + * @param options - The options for fetching the members */ public async getAllMembers(threadId: Snowflake, { signal }: Pick = {}) { return this.rest.get(Routes.threadMembers(threadId), { signal }) as Promise; diff --git a/packages/core/src/api/user.ts b/packages/core/src/api/user.ts index 9a907f950..b6a8608aa 100644 --- a/packages/core/src/api/user.ts +++ b/packages/core/src/api/user.ts @@ -28,7 +28,7 @@ export class UsersAPI { * * @see {@link https://discord.com/developers/docs/resources/user#get-user} * @param userId - The id of the user to fetch - * @param options - The options to use when fetching the user + * @param options - The options for fetching the user */ public async get(userId: Snowflake, { signal }: Pick = {}) { return this.rest.get(Routes.user(userId), { signal }) as Promise; @@ -38,7 +38,7 @@ export class UsersAPI { * Returns the user object of the requester's account * * @see {@link https://discord.com/developers/docs/resources/user#get-current-user} - * @param options - The options to use when fetching the current user + * @param options - The options for fetching the current user */ public async getCurrent({ signal }: Pick = {}) { return this.rest.get(Routes.user('@me'), { signal }) as Promise; @@ -48,8 +48,8 @@ export class UsersAPI { * Returns a list of partial guild objects the current user is a member of * * @see {@link https://discord.com/developers/docs/resources/user#get-current-user-guilds} - * @param query - The query options to use when fetching the current user's guilds - * @param options - The options to use when fetching the guilds + * @param query - The query options for fetching the current user's guilds + * @param options - The options for fetching the guilds */ public async getGuilds(query: RESTGetAPICurrentUserGuildsQuery = {}, { signal }: Pick = {}) { return this.rest.get(Routes.userGuilds(), { @@ -153,8 +153,8 @@ export class UsersAPI { * * @see {@link https://discord.com/developers/docs/resources/user#update-user-application-role-connection} * @param applicationId - The id of the application - * @param body - The data to use when updating the application role connection - * @param options - The options to use when updating the application role connection + * @param body - The data for updating the application role connection + * @param options - The options for updating the application role connection */ public async updateApplicationRoleConnection( applicationId: Snowflake, diff --git a/packages/core/src/api/voice.ts b/packages/core/src/api/voice.ts index 88945de10..a1ff6869b 100644 --- a/packages/core/src/api/voice.ts +++ b/packages/core/src/api/voice.ts @@ -10,7 +10,7 @@ export class VoiceAPI { * Fetches all voice regions * * @see {@link https://discord.com/developers/docs/resources/voice#list-voice-regions} - * @param options - The options to use when fetching the voice regions + * @param options - The options for fetching the voice regions */ public async getVoiceRegions({ signal }: Pick = {}) { return this.rest.get(Routes.voiceRegions(), { signal }) as Promise; diff --git a/packages/core/src/api/webhook.ts b/packages/core/src/api/webhook.ts index 6f986198c..cfa25122b 100644 --- a/packages/core/src/api/webhook.ts +++ b/packages/core/src/api/webhook.ts @@ -10,8 +10,6 @@ import { type RESTPatchAPIWebhookResult, type RESTPatchAPIWebhookWithTokenMessageJSONBody, type RESTPatchAPIWebhookWithTokenMessageResult, - type RESTPostAPIChannelWebhookJSONBody, - type RESTPostAPIChannelWebhookResult, type RESTPostAPIWebhookWithTokenGitHubQuery, type RESTPostAPIWebhookWithTokenJSONBody, type RESTPostAPIWebhookWithTokenQuery, @@ -30,32 +28,12 @@ export class WebhooksAPI { * @see {@link https://discord.com/developers/docs/resources/webhook#get-webhook-with-token} * @param id - The id of the webhook * @param token - The token of the webhook - * @param options - The options to use when fetching the webhook + * @param options - The options for fetching the webhook */ public async get(id: Snowflake, token?: string, { signal }: Pick = {}) { return this.rest.get(Routes.webhook(id, token), { signal }) as Promise; } - /** - * Creates a new webhook - * - * @see {@link https://discord.com/developers/docs/resources/webhook#create-webhook} - * @param channelId - The id of the channel to create the webhook in - * @param body - The data to use when creating the webhook - * @param options - The options to use when creating the webhook - */ - public async create( - channelId: Snowflake, - body: RESTPostAPIChannelWebhookJSONBody, - { reason, signal }: Pick = {}, - ) { - return this.rest.post(Routes.channelWebhooks(channelId), { - reason, - body, - signal, - }) as Promise; - } - /** * Edits a webhook * @@ -63,7 +41,7 @@ export class WebhooksAPI { * @see {@link https://discord.com/developers/docs/resources/webhook#modify-webhook-with-token} * @param id - The id of the webhook to edit * @param body - The new webhook data - * @param options - The options to use when editing the webhook + * @param options - The options for editing the webhook */ public async edit( id: Snowflake, @@ -83,7 +61,7 @@ export class WebhooksAPI { * @see {@link https://discord.com/developers/docs/resources/webhook#delete-webhook} * @see {@link https://discord.com/developers/docs/resources/webhook#delete-webhook-with-token} * @param id - The id of the webhook to delete - * @param options - The options to use when deleting the webhook + * @param options - The options for deleting the webhook */ public async delete( id: Snowflake, @@ -98,8 +76,8 @@ export class WebhooksAPI { * @see {@link https://discord.com/developers/docs/resources/webhook#execute-webhook} * @param id - The id of the webhook * @param token - The token of the webhook - * @param body - The data to use when executing the webhook - * @param options - The options to use when executing the webhook + * @param body - The data for executing the webhook + * @param options - The options for executing the webhook */ public async execute( id: Snowflake, @@ -114,8 +92,8 @@ export class WebhooksAPI { * @see {@link https://discord.com/developers/docs/resources/webhook#execute-webhook} * @param id - The id of the webhook * @param token - The token of the webhook - * @param body - The data to use when executing the webhook - * @param options - The options to use when executing the webhook + * @param body - The data for executing the webhook + * @param options - The options for executing the webhook */ public async execute( id: Snowflake, @@ -130,8 +108,8 @@ export class WebhooksAPI { * @see {@link https://discord.com/developers/docs/resources/webhook#execute-webhook} * @param id - The id of the webhook * @param token - The token of the webhook - * @param body - The data to use when executing the webhook - * @param options - The options to use when executing the webhook + * @param body - The data for executing the webhook + * @param options - The options for executing the webhook */ public async execute( id: Snowflake, @@ -160,9 +138,9 @@ export class WebhooksAPI { * @see {@link https://discord.com/developers/docs/resources/webhook#execute-slackcompatible-webhook} * @param id - The id of the webhook * @param token - The token of the webhook - * @param body - The data to use when executing the webhook - * @param query - The query options to use when executing the webhook - * @param options - The options to use when executing the webhook + * @param body - The data for executing the webhook + * @param query - The query options for executing the webhook + * @param options - The options for executing the webhook */ public async executeSlack( id: Snowflake, @@ -185,9 +163,9 @@ export class WebhooksAPI { * @see {@link https://discord.com/developers/docs/resources/webhook#execute-githubcompatible-webhook} * @param id - The id of the webhook * @param token - The token of the webhook - * @param body - The data to use when executing the webhook - * @param query - The options to use when executing the webhook - * @param options - The options to use when executing the webhook + * @param body - The data for executing the webhook + * @param query - The options for executing the webhook + * @param options - The options for executing the webhook */ public async executeGitHub( id: Snowflake, @@ -211,8 +189,8 @@ export class WebhooksAPI { * @param id - The id of the webhook * @param token - The token of the webhook * @param messageId - The id of the message to fetch - * @param query - The query options to use when fetching the message - * @param options - The options to use when fetching the message + * @param query - The query options for fetching the message + * @param options - The options for fetching the message */ public async getMessage( id: Snowflake, @@ -235,8 +213,8 @@ export class WebhooksAPI { * @param id - The id of the webhook * @param token - The token of the webhook * @param messageId - The id of the message to edit - * @param body - The data to use when editing the message - * @param options - The options to use when editing the message + * @param body - The data for editing the message + * @param options - The options for editing the message */ public async editMessage( id: Snowflake, @@ -265,8 +243,8 @@ export class WebhooksAPI { * @param id - The id of the webhook * @param token - The token of the webhook * @param messageId - The id of the message to delete - * @param query - The options to use when deleting the message - * @param options - The options to use when deleting the message + * @param query - The options for deleting the message + * @param options - The options for deleting the message */ public async deleteMessage( id: Snowflake,