Skip to content

Commit

Permalink
fix(core): missed optional options (#9311)
Browse files Browse the repository at this point in the history
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
almeidx and kodiakhq[bot] authored Apr 4, 2023
1 parent 0645bf0 commit 6912faa
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/api/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class ChannelsAPI {
channelId: Snowflake,
messageId: Snowflake,
{ files, ...body }: RESTPostAPIChannelMessageJSONBody & { files?: RawFile[] },
{ signal }: Pick<RequestData, 'signal'>,
{ signal }: Pick<RequestData, 'signal'> = {},
) {
return this.rest.patch(Routes.channelMessage(channelId, messageId), {
files,
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/api/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<RequestData, 'signal'>) {
public async get(guildId: string, { signal }: Pick<RequestData, 'signal'> = {}) {
return this.rest.get(Routes.guild(guildId), { signal }) as Promise<RESTGetAPIGuildResult>;
}

Expand All @@ -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<RequestData, 'signal'>) {
public async getPreview(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) {
return this.rest.get(Routes.guildPreview(guildId), {
signal,
}) as Promise<RESTGetAPIGuildPreviewResult>;
Expand All @@ -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<RequestData, 'signal'>) {
public async create(body: RESTPostAPIGuildsJSONBody, { signal }: Pick<RequestData, 'signal'> = {}) {
return this.rest.post(Routes.guilds(), { body, signal }) as Promise<RESTPostAPIGuildsResult>;
}

Expand Down Expand Up @@ -361,7 +361,7 @@ export class GuildsAPI {
public async deleteRole(
guildId: Snowflake,
roleId: Snowflake,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'>,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {},
) {
await this.rest.delete(Routes.guildRole(guildId, roleId), { reason, signal });
}
Expand Down Expand Up @@ -1129,7 +1129,7 @@ export class GuildsAPI {
guildId: Snowflake,
userId: Snowflake,
roleId: Snowflake,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'>,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {},
) {
await this.rest.delete(Routes.guildMemberRole(guildId, userId, roleId), { reason, signal });
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/api/interactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export class InteractionsAPI {
public async getOriginalReply(
applicationId: Snowflake,
interactionToken: string,
{ signal }: Pick<RequestData, 'signal'>,
{ signal }: Pick<RequestData, 'signal'> = {},
) {
return this.webhooks.getMessage(
applicationId,
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/api/webhook.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -103,7 +103,7 @@ export class WebhooksAPI {
id: Snowflake,
token: string,
body: RESTPostAPIWebhookWithTokenJSONBody & RESTPostAPIWebhookWithTokenQuery & { files?: RawFile[]; wait: true },
{ signal }: Pick<RequestData, 'signal'>,
options?: Pick<RequestData, 'signal'>,
): Promise<RESTPostAPIWebhookWithTokenWaitResult>;

/**
Expand All @@ -119,7 +119,7 @@ export class WebhooksAPI {
id: Snowflake,
token: string,
body: RESTPostAPIWebhookWithTokenJSONBody & RESTPostAPIWebhookWithTokenQuery & { files?: RawFile[]; wait?: false },
{ signal }: Pick<RequestData, 'signal'>,
options?: Pick<RequestData, 'signal'>,
): Promise<void>;

/**
Expand Down

0 comments on commit 6912faa

Please sign in to comment.