From 6912faa9b3852adbacc7d0b002aae81be041f529 Mon Sep 17 00:00:00 2001 From: Almeida Date: Tue, 4 Apr 2023 19:37:26 +0100 Subject: [PATCH] fix(core): missed optional options (#9311) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- packages/core/src/api/channel.ts | 2 +- packages/core/src/api/guild.ts | 10 +++++----- packages/core/src/api/interactions.ts | 2 +- packages/core/src/api/webhook.ts | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/core/src/api/channel.ts b/packages/core/src/api/channel.ts index af4596845..ae18a00db 100644 --- a/packages/core/src/api/channel.ts +++ b/packages/core/src/api/channel.ts @@ -61,7 +61,7 @@ export class ChannelsAPI { channelId: Snowflake, messageId: Snowflake, { files, ...body }: RESTPostAPIChannelMessageJSONBody & { files?: RawFile[] }, - { signal }: Pick, + { signal }: Pick = {}, ) { return this.rest.patch(Routes.channelMessage(channelId, messageId), { files, diff --git a/packages/core/src/api/guild.ts b/packages/core/src/api/guild.ts index 8b4161c67..5993dcc53 100644 --- a/packages/core/src/api/guild.ts +++ b/packages/core/src/api/guild.ts @@ -98,7 +98,7 @@ export class GuildsAPI { * @param guildId - The id of the guild * @param options - The options for fetching the guild */ - public async get(guildId: string, { signal }: Pick) { + public async get(guildId: string, { signal }: Pick = {}) { return this.rest.get(Routes.guild(guildId), { signal }) as Promise; } @@ -109,7 +109,7 @@ export class GuildsAPI { * @param guildId - The id of the guild to fetch the preview from * @param options - The options for fetching the guild preview */ - public async getPreview(guildId: Snowflake, { signal }: Pick) { + public async getPreview(guildId: Snowflake, { signal }: Pick = {}) { return this.rest.get(Routes.guildPreview(guildId), { signal, }) as Promise; @@ -122,7 +122,7 @@ export class GuildsAPI { * @param body - The guild to create * @param options - The options for creating the guild */ - public async create(body: RESTPostAPIGuildsJSONBody, { signal }: Pick) { + public async create(body: RESTPostAPIGuildsJSONBody, { signal }: Pick = {}) { return this.rest.post(Routes.guilds(), { body, signal }) as Promise; } @@ -361,7 +361,7 @@ export class GuildsAPI { public async deleteRole( guildId: Snowflake, roleId: Snowflake, - { reason, signal }: Pick, + { reason, signal }: Pick = {}, ) { await this.rest.delete(Routes.guildRole(guildId, roleId), { reason, signal }); } @@ -1129,7 +1129,7 @@ export class GuildsAPI { guildId: Snowflake, userId: Snowflake, roleId: Snowflake, - { reason, signal }: Pick, + { reason, signal }: Pick = {}, ) { await this.rest.delete(Routes.guildMemberRole(guildId, userId, roleId), { reason, signal }); } diff --git a/packages/core/src/api/interactions.ts b/packages/core/src/api/interactions.ts index 885efdcdd..9b763d145 100644 --- a/packages/core/src/api/interactions.ts +++ b/packages/core/src/api/interactions.ts @@ -138,7 +138,7 @@ export class InteractionsAPI { public async getOriginalReply( applicationId: Snowflake, interactionToken: string, - { signal }: Pick, + { signal }: Pick = {}, ) { return this.webhooks.getMessage( applicationId, diff --git a/packages/core/src/api/webhook.ts b/packages/core/src/api/webhook.ts index e307b3f4f..de3cdbd2a 100644 --- a/packages/core/src/api/webhook.ts +++ b/packages/core/src/api/webhook.ts @@ -1,6 +1,6 @@ import { makeURLSearchParams, type RequestData, type RawFile, type REST } from '@discordjs/rest'; -import { Routes } from 'discord-api-types/v10'; import { + Routes, type RESTGetAPIWebhookWithTokenMessageQuery, type RESTGetAPIChannelMessageResult, type RESTGetAPIWebhookResult, @@ -103,7 +103,7 @@ export class WebhooksAPI { id: Snowflake, token: string, body: RESTPostAPIWebhookWithTokenJSONBody & RESTPostAPIWebhookWithTokenQuery & { files?: RawFile[]; wait: true }, - { signal }: Pick, + options?: Pick, ): Promise; /** @@ -119,7 +119,7 @@ export class WebhooksAPI { id: Snowflake, token: string, body: RESTPostAPIWebhookWithTokenJSONBody & RESTPostAPIWebhookWithTokenQuery & { files?: RawFile[]; wait?: false }, - { signal }: Pick, + options?: Pick, ): Promise; /**