mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 20:43:30 +01:00
fix(core): missed optional options (#9311)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -61,7 +61,7 @@ export class ChannelsAPI {
|
|||||||
channelId: Snowflake,
|
channelId: Snowflake,
|
||||||
messageId: Snowflake,
|
messageId: Snowflake,
|
||||||
{ files, ...body }: RESTPostAPIChannelMessageJSONBody & { files?: RawFile[] },
|
{ files, ...body }: RESTPostAPIChannelMessageJSONBody & { files?: RawFile[] },
|
||||||
{ signal }: Pick<RequestData, 'signal'>,
|
{ signal }: Pick<RequestData, 'signal'> = {},
|
||||||
) {
|
) {
|
||||||
return this.rest.patch(Routes.channelMessage(channelId, messageId), {
|
return this.rest.patch(Routes.channelMessage(channelId, messageId), {
|
||||||
files,
|
files,
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ export class GuildsAPI {
|
|||||||
* @param guildId - The id of the guild
|
* @param guildId - The id of the guild
|
||||||
* @param options - The options for fetching 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>;
|
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 guildId - The id of the guild to fetch the preview from
|
||||||
* @param options - The options for fetching the guild preview
|
* @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), {
|
return this.rest.get(Routes.guildPreview(guildId), {
|
||||||
signal,
|
signal,
|
||||||
}) as Promise<RESTGetAPIGuildPreviewResult>;
|
}) as Promise<RESTGetAPIGuildPreviewResult>;
|
||||||
@@ -122,7 +122,7 @@ export class GuildsAPI {
|
|||||||
* @param body - The guild to create
|
* @param body - The guild to create
|
||||||
* @param options - The options for creating the guild
|
* @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>;
|
return this.rest.post(Routes.guilds(), { body, signal }) as Promise<RESTPostAPIGuildsResult>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,7 +361,7 @@ export class GuildsAPI {
|
|||||||
public async deleteRole(
|
public async deleteRole(
|
||||||
guildId: Snowflake,
|
guildId: Snowflake,
|
||||||
roleId: 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 });
|
await this.rest.delete(Routes.guildRole(guildId, roleId), { reason, signal });
|
||||||
}
|
}
|
||||||
@@ -1129,7 +1129,7 @@ export class GuildsAPI {
|
|||||||
guildId: Snowflake,
|
guildId: Snowflake,
|
||||||
userId: Snowflake,
|
userId: Snowflake,
|
||||||
roleId: 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 });
|
await this.rest.delete(Routes.guildMemberRole(guildId, userId, roleId), { reason, signal });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ export class InteractionsAPI {
|
|||||||
public async getOriginalReply(
|
public async getOriginalReply(
|
||||||
applicationId: Snowflake,
|
applicationId: Snowflake,
|
||||||
interactionToken: string,
|
interactionToken: string,
|
||||||
{ signal }: Pick<RequestData, 'signal'>,
|
{ signal }: Pick<RequestData, 'signal'> = {},
|
||||||
) {
|
) {
|
||||||
return this.webhooks.getMessage(
|
return this.webhooks.getMessage(
|
||||||
applicationId,
|
applicationId,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { makeURLSearchParams, type RequestData, type RawFile, type REST } from '@discordjs/rest';
|
import { makeURLSearchParams, type RequestData, type RawFile, type REST } from '@discordjs/rest';
|
||||||
import { Routes } from 'discord-api-types/v10';
|
|
||||||
import {
|
import {
|
||||||
|
Routes,
|
||||||
type RESTGetAPIWebhookWithTokenMessageQuery,
|
type RESTGetAPIWebhookWithTokenMessageQuery,
|
||||||
type RESTGetAPIChannelMessageResult,
|
type RESTGetAPIChannelMessageResult,
|
||||||
type RESTGetAPIWebhookResult,
|
type RESTGetAPIWebhookResult,
|
||||||
@@ -103,7 +103,7 @@ export class WebhooksAPI {
|
|||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
token: string,
|
token: string,
|
||||||
body: RESTPostAPIWebhookWithTokenJSONBody & RESTPostAPIWebhookWithTokenQuery & { files?: RawFile[]; wait: true },
|
body: RESTPostAPIWebhookWithTokenJSONBody & RESTPostAPIWebhookWithTokenQuery & { files?: RawFile[]; wait: true },
|
||||||
{ signal }: Pick<RequestData, 'signal'>,
|
options?: Pick<RequestData, 'signal'>,
|
||||||
): Promise<RESTPostAPIWebhookWithTokenWaitResult>;
|
): Promise<RESTPostAPIWebhookWithTokenWaitResult>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -119,7 +119,7 @@ export class WebhooksAPI {
|
|||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
token: string,
|
token: string,
|
||||||
body: RESTPostAPIWebhookWithTokenJSONBody & RESTPostAPIWebhookWithTokenQuery & { files?: RawFile[]; wait?: false },
|
body: RESTPostAPIWebhookWithTokenJSONBody & RESTPostAPIWebhookWithTokenQuery & { files?: RawFile[]; wait?: false },
|
||||||
{ signal }: Pick<RequestData, 'signal'>,
|
options?: Pick<RequestData, 'signal'>,
|
||||||
): Promise<void>;
|
): Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user