fix(core): missed optional options (#9311)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Almeida
2023-04-04 19:37:26 +01:00
committed by GitHub
parent 0645bf0f7f
commit 6912faa9b3
4 changed files with 10 additions and 10 deletions

View File

@@ -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,

View File

@@ -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>;
}
@@ -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>;
@@ -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>;
}
@@ -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 });
}
@@ -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 });
}

View File

@@ -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,

View File

@@ -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<RequestData, 'signal'>,
options?: Pick<RequestData, 'signal'>,
): Promise<RESTPostAPIWebhookWithTokenWaitResult>;
/**
@@ -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>;
/**