mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 04:53:30 +01:00
chore(deps): bump discord-api-types (#10841)
* chore(deps): bump discord-api-types * chore: tests * chore: tests 2 * chore: replace ImageSize type with dtypes type
This commit is contained in:
@@ -2,7 +2,7 @@ import {
|
|||||||
ButtonStyle,
|
ButtonStyle,
|
||||||
ComponentType,
|
ComponentType,
|
||||||
type APIActionRowComponent,
|
type APIActionRowComponent,
|
||||||
type APIMessageActionRowComponent,
|
type APIComponentInMessageActionRow,
|
||||||
} from 'discord-api-types/v10';
|
} from 'discord-api-types/v10';
|
||||||
import { describe, test, expect } from 'vitest';
|
import { describe, test, expect } from 'vitest';
|
||||||
import {
|
import {
|
||||||
@@ -13,7 +13,7 @@ import {
|
|||||||
StringSelectMenuOptionBuilder,
|
StringSelectMenuOptionBuilder,
|
||||||
} from '../../src/index.js';
|
} from '../../src/index.js';
|
||||||
|
|
||||||
const rowWithButtonData: APIActionRowComponent<APIMessageActionRowComponent> = {
|
const rowWithButtonData: APIActionRowComponent<APIComponentInMessageActionRow> = {
|
||||||
type: ComponentType.ActionRow,
|
type: ComponentType.ActionRow,
|
||||||
components: [
|
components: [
|
||||||
{
|
{
|
||||||
@@ -25,7 +25,7 @@ const rowWithButtonData: APIActionRowComponent<APIMessageActionRowComponent> = {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
const rowWithSelectMenuData: APIActionRowComponent<APIMessageActionRowComponent> = {
|
const rowWithSelectMenuData: APIActionRowComponent<APIComponentInMessageActionRow> = {
|
||||||
type: ComponentType.ActionRow,
|
type: ComponentType.ActionRow,
|
||||||
components: [
|
components: [
|
||||||
{
|
{
|
||||||
@@ -50,7 +50,7 @@ const rowWithSelectMenuData: APIActionRowComponent<APIMessageActionRowComponent>
|
|||||||
describe('Action Row Components', () => {
|
describe('Action Row Components', () => {
|
||||||
describe('Assertion Tests', () => {
|
describe('Assertion Tests', () => {
|
||||||
test('GIVEN valid JSON input THEN valid JSON output is given', () => {
|
test('GIVEN valid JSON input THEN valid JSON output is given', () => {
|
||||||
const actionRowData: APIActionRowComponent<APIMessageActionRowComponent> = {
|
const actionRowData: APIActionRowComponent<APIComponentInMessageActionRow> = {
|
||||||
type: ComponentType.ActionRow,
|
type: ComponentType.ActionRow,
|
||||||
components: [
|
components: [
|
||||||
{
|
{
|
||||||
@@ -73,7 +73,7 @@ describe('Action Row Components', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('GIVEN valid builder options THEN valid JSON output is given', () => {
|
test('GIVEN valid builder options THEN valid JSON output is given', () => {
|
||||||
const rowWithButtonData: APIActionRowComponent<APIMessageActionRowComponent> = {
|
const rowWithButtonData: APIActionRowComponent<APIComponentInMessageActionRow> = {
|
||||||
type: ComponentType.ActionRow,
|
type: ComponentType.ActionRow,
|
||||||
components: [
|
components: [
|
||||||
{
|
{
|
||||||
@@ -85,7 +85,7 @@ describe('Action Row Components', () => {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
const rowWithSelectMenuData: APIActionRowComponent<APIMessageActionRowComponent> = {
|
const rowWithSelectMenuData: APIActionRowComponent<APIComponentInMessageActionRow> = {
|
||||||
type: ComponentType.ActionRow,
|
type: ComponentType.ActionRow,
|
||||||
components: [
|
components: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
ComponentType,
|
ComponentType,
|
||||||
TextInputStyle,
|
TextInputStyle,
|
||||||
type APIButtonComponent,
|
type APIButtonComponent,
|
||||||
type APIMessageActionRowComponent,
|
type APIComponentInMessageActionRow,
|
||||||
type APISelectMenuComponent,
|
type APISelectMenuComponent,
|
||||||
type APITextInputComponent,
|
type APITextInputComponent,
|
||||||
type APIActionRowComponent,
|
type APIActionRowComponent,
|
||||||
@@ -27,7 +27,7 @@ describe('createComponentBuilder', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
test('GIVEN an action row component THEN returns a ActionRowBuilder', () => {
|
test('GIVEN an action row component THEN returns a ActionRowBuilder', () => {
|
||||||
const actionRow: APIActionRowComponent<APIMessageActionRowComponent> = {
|
const actionRow: APIActionRowComponent<APIComponentInMessageActionRow> = {
|
||||||
components: [],
|
components: [],
|
||||||
type: ComponentType.ActionRow,
|
type: ComponentType.ActionRow,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
"funding": "https://github.com/discordjs/discord.js?sponsor",
|
"funding": "https://github.com/discordjs/discord.js?sponsor",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordjs/util": "workspace:^",
|
"@discordjs/util": "workspace:^",
|
||||||
"discord-api-types": "^0.37.120",
|
"discord-api-types": "^0.38.1",
|
||||||
"ts-mixer": "^6.0.4",
|
"ts-mixer": "^6.0.4",
|
||||||
"tslib": "^2.8.1",
|
"tslib": "^2.8.1",
|
||||||
"zod": "^3.24.2",
|
"zod": "^3.24.2",
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import type {
|
import type {
|
||||||
APITextInputComponent,
|
APITextInputComponent,
|
||||||
APIActionRowComponent,
|
APIActionRowComponent,
|
||||||
APIActionRowComponentTypes,
|
APIComponentInActionRow,
|
||||||
APIChannelSelectComponent,
|
APIChannelSelectComponent,
|
||||||
APIMentionableSelectComponent,
|
APIMentionableSelectComponent,
|
||||||
APIRoleSelectComponent,
|
APIRoleSelectComponent,
|
||||||
@@ -37,7 +37,7 @@ import { UserSelectMenuBuilder } from './selectMenu/UserSelectMenu.js';
|
|||||||
import { TextInputBuilder } from './textInput/TextInput.js';
|
import { TextInputBuilder } from './textInput/TextInput.js';
|
||||||
|
|
||||||
export interface ActionRowBuilderData
|
export interface ActionRowBuilderData
|
||||||
extends Partial<Omit<APIActionRowComponent<APIActionRowComponentTypes>, 'components'>> {
|
extends Partial<Omit<APIActionRowComponent<APIComponentInActionRow>, 'components'>> {
|
||||||
components: AnyActionRowComponentBuilder[];
|
components: AnyActionRowComponentBuilder[];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ export interface ActionRowBuilderData
|
|||||||
*
|
*
|
||||||
* @typeParam ComponentType - The types of components this action row holds
|
* @typeParam ComponentType - The types of components this action row holds
|
||||||
*/
|
*/
|
||||||
export class ActionRowBuilder extends ComponentBuilder<APIActionRowComponent<APIActionRowComponentTypes>> {
|
export class ActionRowBuilder extends ComponentBuilder<APIActionRowComponent<APIComponentInActionRow>> {
|
||||||
private readonly data: ActionRowBuilderData;
|
private readonly data: ActionRowBuilderData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -90,7 +90,7 @@ export class ActionRowBuilder extends ComponentBuilder<APIActionRowComponent<API
|
|||||||
* .addComponents(button2, button3);
|
* .addComponents(button2, button3);
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
public constructor({ components = [], ...data }: Partial<APIActionRowComponent<APIActionRowComponentTypes>> = {}) {
|
public constructor({ components = [], ...data }: Partial<APIActionRowComponent<APIComponentInActionRow>> = {}) {
|
||||||
super();
|
super();
|
||||||
this.data = {
|
this.data = {
|
||||||
...structuredClone(data),
|
...structuredClone(data),
|
||||||
@@ -328,7 +328,7 @@ export class ActionRowBuilder extends ComponentBuilder<APIActionRowComponent<API
|
|||||||
/**
|
/**
|
||||||
* {@inheritDoc ComponentBuilder.toJSON}
|
* {@inheritDoc ComponentBuilder.toJSON}
|
||||||
*/
|
*/
|
||||||
public override toJSON(validationOverride?: boolean): APIActionRowComponent<APIActionRowComponentTypes> {
|
public override toJSON(validationOverride?: boolean): APIActionRowComponent<APIComponentInActionRow> {
|
||||||
const { components, ...rest } = this.data;
|
const { components, ...rest } = this.data;
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
@@ -338,6 +338,6 @@ export class ActionRowBuilder extends ComponentBuilder<APIActionRowComponent<API
|
|||||||
|
|
||||||
validate(actionRowPredicate, data, validationOverride);
|
validate(actionRowPredicate, data, validationOverride);
|
||||||
|
|
||||||
return data as APIActionRowComponent<APIActionRowComponentTypes>;
|
return data as APIActionRowComponent<APIComponentInActionRow>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import type { JSONEncodable } from '@discordjs/util';
|
import type { JSONEncodable } from '@discordjs/util';
|
||||||
import type { APIActionRowComponent, APIActionRowComponentTypes } from 'discord-api-types/v10';
|
import type { APIActionRowComponent, APIComponentInActionRow } from 'discord-api-types/v10';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Any action row component data represented as an object.
|
* Any action row component data represented as an object.
|
||||||
*/
|
*/
|
||||||
export type AnyAPIActionRowComponent = APIActionRowComponent<APIActionRowComponentTypes> | APIActionRowComponentTypes;
|
export type AnyAPIActionRowComponent = APIActionRowComponent<APIComponentInActionRow> | APIComponentInActionRow;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base component builder that contains common symbols for all sorts of components.
|
* The base component builder that contains common symbols for all sorts of components.
|
||||||
|
|||||||
@@ -144,6 +144,36 @@ export function createComponentBuilder(
|
|||||||
return new MentionableSelectMenuBuilder(data);
|
return new MentionableSelectMenuBuilder(data);
|
||||||
case ComponentType.ChannelSelect:
|
case ComponentType.ChannelSelect:
|
||||||
return new ChannelSelectMenuBuilder(data);
|
return new ChannelSelectMenuBuilder(data);
|
||||||
|
|
||||||
|
// Will be handled later
|
||||||
|
case ComponentType.Section: {
|
||||||
|
throw new Error('Not implemented yet: ComponentType.Section case');
|
||||||
|
}
|
||||||
|
|
||||||
|
case ComponentType.TextDisplay: {
|
||||||
|
throw new Error('Not implemented yet: ComponentType.TextDisplay case');
|
||||||
|
}
|
||||||
|
|
||||||
|
case ComponentType.Thumbnail: {
|
||||||
|
throw new Error('Not implemented yet: ComponentType.Thumbnail case');
|
||||||
|
}
|
||||||
|
|
||||||
|
case ComponentType.MediaGallery: {
|
||||||
|
throw new Error('Not implemented yet: ComponentType.MediaGallery case');
|
||||||
|
}
|
||||||
|
|
||||||
|
case ComponentType.File: {
|
||||||
|
throw new Error('Not implemented yet: ComponentType.File case');
|
||||||
|
}
|
||||||
|
|
||||||
|
case ComponentType.Separator: {
|
||||||
|
throw new Error('Not implemented yet: ComponentType.Separator case');
|
||||||
|
}
|
||||||
|
|
||||||
|
case ComponentType.Container: {
|
||||||
|
throw new Error('Not implemented yet: ComponentType.Container case');
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// @ts-expect-error This case can still occur if we get a newer unsupported component type
|
// @ts-expect-error This case can still occur if we get a newer unsupported component type
|
||||||
throw new Error(`Cannot properly serialize component type: ${data.type}`);
|
throw new Error(`Cannot properly serialize component type: ${data.type}`);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import type { JSONEncodable } from '@discordjs/util';
|
import type { JSONEncodable } from '@discordjs/util';
|
||||||
import type {
|
import type {
|
||||||
APIActionRowComponent,
|
APIActionRowComponent,
|
||||||
APIModalActionRowComponent,
|
APIComponentInModalActionRow,
|
||||||
APIModalInteractionResponseCallbackData,
|
APIModalInteractionResponseCallbackData,
|
||||||
} from 'discord-api-types/v10';
|
} from 'discord-api-types/v10';
|
||||||
import { ActionRowBuilder } from '../../components/ActionRow.js';
|
import { ActionRowBuilder } from '../../components/ActionRow.js';
|
||||||
@@ -73,7 +73,7 @@ export class ModalBuilder implements JSONEncodable<APIModalInteractionResponseCa
|
|||||||
public addActionRows(
|
public addActionRows(
|
||||||
...components: RestOrArray<
|
...components: RestOrArray<
|
||||||
| ActionRowBuilder
|
| ActionRowBuilder
|
||||||
| APIActionRowComponent<APIModalActionRowComponent>
|
| APIActionRowComponent<APIComponentInModalActionRow>
|
||||||
| ((builder: ActionRowBuilder) => ActionRowBuilder)
|
| ((builder: ActionRowBuilder) => ActionRowBuilder)
|
||||||
>
|
>
|
||||||
) {
|
) {
|
||||||
@@ -93,7 +93,7 @@ export class ModalBuilder implements JSONEncodable<APIModalInteractionResponseCa
|
|||||||
public setActionRows(
|
public setActionRows(
|
||||||
...components: RestOrArray<
|
...components: RestOrArray<
|
||||||
| ActionRowBuilder
|
| ActionRowBuilder
|
||||||
| APIActionRowComponent<APIModalActionRowComponent>
|
| APIActionRowComponent<APIComponentInModalActionRow>
|
||||||
| ((builder: ActionRowBuilder) => ActionRowBuilder)
|
| ((builder: ActionRowBuilder) => ActionRowBuilder)
|
||||||
>
|
>
|
||||||
) {
|
) {
|
||||||
@@ -137,7 +137,7 @@ export class ModalBuilder implements JSONEncodable<APIModalInteractionResponseCa
|
|||||||
deleteCount: number,
|
deleteCount: number,
|
||||||
...rows: (
|
...rows: (
|
||||||
| ActionRowBuilder
|
| ActionRowBuilder
|
||||||
| APIActionRowComponent<APIModalActionRowComponent>
|
| APIActionRowComponent<APIComponentInModalActionRow>
|
||||||
| ((builder: ActionRowBuilder) => ActionRowBuilder)
|
| ((builder: ActionRowBuilder) => ActionRowBuilder)
|
||||||
)[]
|
)[]
|
||||||
): this {
|
): this {
|
||||||
|
|||||||
@@ -4,12 +4,13 @@ import type {
|
|||||||
APIAllowedMentions,
|
APIAllowedMentions,
|
||||||
APIAttachment,
|
APIAttachment,
|
||||||
APIEmbed,
|
APIEmbed,
|
||||||
APIMessageActionRowComponent,
|
APIComponentInMessageActionRow,
|
||||||
APIMessageReference,
|
APIMessageReference,
|
||||||
APIPoll,
|
APIPoll,
|
||||||
RESTPostAPIChannelMessageJSONBody,
|
RESTPostAPIChannelMessageJSONBody,
|
||||||
Snowflake,
|
Snowflake,
|
||||||
MessageFlags,
|
MessageFlags,
|
||||||
|
APIComponentInActionRow,
|
||||||
} from 'discord-api-types/v10';
|
} from 'discord-api-types/v10';
|
||||||
import { ActionRowBuilder } from '../components/ActionRow.js';
|
import { ActionRowBuilder } from '../components/ActionRow.js';
|
||||||
import { normalizeArray, type RestOrArray } from '../util/normalizeArray.js';
|
import { normalizeArray, type RestOrArray } from '../util/normalizeArray.js';
|
||||||
@@ -76,7 +77,10 @@ export class MessageBuilder implements JSONEncodable<RESTPostAPIChannelMessageJS
|
|||||||
attachments: data.attachments?.map((attachment) => new AttachmentBuilder(attachment)) ?? [],
|
attachments: data.attachments?.map((attachment) => new AttachmentBuilder(attachment)) ?? [],
|
||||||
embeds: data.embeds?.map((embed) => new EmbedBuilder(embed)) ?? [],
|
embeds: data.embeds?.map((embed) => new EmbedBuilder(embed)) ?? [],
|
||||||
poll: data.poll ? new PollBuilder(data.poll) : undefined,
|
poll: data.poll ? new PollBuilder(data.poll) : undefined,
|
||||||
components: data.components?.map((component) => new ActionRowBuilder(component)) ?? [],
|
components:
|
||||||
|
data.components?.map(
|
||||||
|
(component) => new ActionRowBuilder(component as unknown as APIActionRowComponent<APIComponentInActionRow>),
|
||||||
|
) ?? [],
|
||||||
message_reference: data.message_reference ? new MessageReferenceBuilder(data.message_reference) : undefined,
|
message_reference: data.message_reference ? new MessageReferenceBuilder(data.message_reference) : undefined,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -271,7 +275,7 @@ export class MessageBuilder implements JSONEncodable<RESTPostAPIChannelMessageJS
|
|||||||
public addComponents(
|
public addComponents(
|
||||||
...components: RestOrArray<
|
...components: RestOrArray<
|
||||||
| ActionRowBuilder
|
| ActionRowBuilder
|
||||||
| APIActionRowComponent<APIMessageActionRowComponent>
|
| APIActionRowComponent<APIComponentInMessageActionRow>
|
||||||
| ((builder: ActionRowBuilder) => ActionRowBuilder)
|
| ((builder: ActionRowBuilder) => ActionRowBuilder)
|
||||||
>
|
>
|
||||||
): this {
|
): this {
|
||||||
@@ -316,7 +320,7 @@ export class MessageBuilder implements JSONEncodable<RESTPostAPIChannelMessageJS
|
|||||||
deleteCount: number,
|
deleteCount: number,
|
||||||
...components: RestOrArray<
|
...components: RestOrArray<
|
||||||
| ActionRowBuilder
|
| ActionRowBuilder
|
||||||
| APIActionRowComponent<APIMessageActionRowComponent>
|
| APIActionRowComponent<APIComponentInMessageActionRow>
|
||||||
| ((builder: ActionRowBuilder) => ActionRowBuilder)
|
| ((builder: ActionRowBuilder) => ActionRowBuilder)
|
||||||
>
|
>
|
||||||
): this {
|
): this {
|
||||||
@@ -335,7 +339,7 @@ export class MessageBuilder implements JSONEncodable<RESTPostAPIChannelMessageJS
|
|||||||
public setComponents(
|
public setComponents(
|
||||||
...components: RestOrArray<
|
...components: RestOrArray<
|
||||||
| ActionRowBuilder
|
| ActionRowBuilder
|
||||||
| APIActionRowComponent<APIMessageActionRowComponent>
|
| APIActionRowComponent<APIComponentInMessageActionRow>
|
||||||
| ((builder: ActionRowBuilder) => ActionRowBuilder)
|
| ((builder: ActionRowBuilder) => ActionRowBuilder)
|
||||||
>
|
>
|
||||||
): this {
|
): this {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { REST } from '@discordjs/rest';
|
import { REST } from '@discordjs/rest';
|
||||||
import type {
|
import type {
|
||||||
APIActionRowComponent,
|
APIActionRowComponent,
|
||||||
APIModalActionRowComponent,
|
APIComponentInModalActionRow,
|
||||||
RESTPostAPIInteractionCallbackWithResponseResult,
|
RESTPostAPIInteractionCallbackWithResponseResult,
|
||||||
} from 'discord-api-types/v10';
|
} from 'discord-api-types/v10';
|
||||||
import { expectTypeOf, describe, test } from 'vitest';
|
import { expectTypeOf, describe, test } from 'vitest';
|
||||||
@@ -11,7 +11,7 @@ const rest = new REST();
|
|||||||
const api = new API(rest);
|
const api = new API(rest);
|
||||||
const SNOWFLAKE = '123456789012345678' as const;
|
const SNOWFLAKE = '123456789012345678' as const;
|
||||||
const TOKEN = 'token' as const;
|
const TOKEN = 'token' as const;
|
||||||
const MODAL_COMPONENTS: APIActionRowComponent<APIModalActionRowComponent>[] = [] as const;
|
const MODAL_COMPONENTS: APIActionRowComponent<APIComponentInModalActionRow>[] = [] as const;
|
||||||
const boolValue = true as boolean;
|
const boolValue = true as boolean;
|
||||||
|
|
||||||
describe('Interaction with_response overloads.', () => {
|
describe('Interaction with_response overloads.', () => {
|
||||||
|
|||||||
@@ -70,7 +70,7 @@
|
|||||||
"@discordjs/ws": "workspace:^",
|
"@discordjs/ws": "workspace:^",
|
||||||
"@sapphire/snowflake": "^3.5.5",
|
"@sapphire/snowflake": "^3.5.5",
|
||||||
"@vladfrangu/async_event_emitter": "^2.4.6",
|
"@vladfrangu/async_event_emitter": "^2.4.6",
|
||||||
"discord-api-types": "^0.37.120"
|
"discord-api-types": "^0.38.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@discordjs/api-extractor": "workspace:^",
|
"@discordjs/api-extractor": "workspace:^",
|
||||||
|
|||||||
@@ -73,7 +73,7 @@
|
|||||||
"@discordjs/ws": "workspace:^",
|
"@discordjs/ws": "workspace:^",
|
||||||
"@sapphire/snowflake": "3.5.5",
|
"@sapphire/snowflake": "3.5.5",
|
||||||
"@vladfrangu/async_event_emitter": "^2.4.6",
|
"@vladfrangu/async_event_emitter": "^2.4.6",
|
||||||
"discord-api-types": "^0.37.120",
|
"discord-api-types": "^0.38.1",
|
||||||
"fast-deep-equal": "3.1.3",
|
"fast-deep-equal": "3.1.3",
|
||||||
"lodash.snakecase": "4.1.1",
|
"lodash.snakecase": "4.1.1",
|
||||||
"tslib": "^2.8.1",
|
"tslib": "^2.8.1",
|
||||||
|
|||||||
30
packages/discord.js/typings/index.d.ts
vendored
30
packages/discord.js/typings/index.d.ts
vendored
@@ -68,13 +68,13 @@ import {
|
|||||||
AuditLogEvent,
|
AuditLogEvent,
|
||||||
APIMessageComponentEmoji,
|
APIMessageComponentEmoji,
|
||||||
EmbedType,
|
EmbedType,
|
||||||
APIActionRowComponentTypes,
|
APIComponentInActionRow,
|
||||||
APIModalInteractionResponseCallbackData,
|
APIModalInteractionResponseCallbackData,
|
||||||
APIModalSubmitInteraction,
|
APIModalSubmitInteraction,
|
||||||
APIMessageActionRowComponent,
|
APIComponentInMessageActionRow,
|
||||||
TextInputStyle,
|
TextInputStyle,
|
||||||
APITextInputComponent,
|
APITextInputComponent,
|
||||||
APIModalActionRowComponent,
|
APIComponentInModalActionRow,
|
||||||
APIModalComponent,
|
APIModalComponent,
|
||||||
APISelectMenuOption,
|
APISelectMenuOption,
|
||||||
APIEmbedField,
|
APIEmbedField,
|
||||||
@@ -258,7 +258,7 @@ export interface BaseComponentData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type MessageActionRowComponentData =
|
export type MessageActionRowComponentData =
|
||||||
| JSONEncodable<APIMessageActionRowComponent>
|
| JSONEncodable<APIComponentInMessageActionRow>
|
||||||
| ButtonComponentData
|
| ButtonComponentData
|
||||||
| StringSelectMenuComponentData
|
| StringSelectMenuComponentData
|
||||||
| UserSelectMenuComponentData
|
| UserSelectMenuComponentData
|
||||||
@@ -266,13 +266,13 @@ export type MessageActionRowComponentData =
|
|||||||
| MentionableSelectMenuComponentData
|
| MentionableSelectMenuComponentData
|
||||||
| ChannelSelectMenuComponentData;
|
| ChannelSelectMenuComponentData;
|
||||||
|
|
||||||
export type ModalActionRowComponentData = JSONEncodable<APIModalActionRowComponent> | TextInputComponentData;
|
export type ModalActionRowComponentData = JSONEncodable<APIComponentInModalActionRow> | TextInputComponentData;
|
||||||
|
|
||||||
export type ActionRowComponentData = MessageActionRowComponentData | ModalActionRowComponentData;
|
export type ActionRowComponentData = MessageActionRowComponentData | ModalActionRowComponentData;
|
||||||
|
|
||||||
export type ActionRowComponent = MessageActionRowComponent | ModalActionRowComponent;
|
export type ActionRowComponent = MessageActionRowComponent | ModalActionRowComponent;
|
||||||
|
|
||||||
export interface ActionRowData<ComponentType extends JSONEncodable<APIActionRowComponentTypes> | ActionRowComponentData>
|
export interface ActionRowData<ComponentType extends JSONEncodable<APIComponentInActionRow> | ActionRowComponentData>
|
||||||
extends BaseComponentData {
|
extends BaseComponentData {
|
||||||
components: readonly ComponentType[];
|
components: readonly ComponentType[];
|
||||||
}
|
}
|
||||||
@@ -287,9 +287,9 @@ export type MessageActionRowComponent =
|
|||||||
export type ModalActionRowComponent = TextInputComponent;
|
export type ModalActionRowComponent = TextInputComponent;
|
||||||
|
|
||||||
export class ActionRow<ComponentType extends MessageActionRowComponent | ModalActionRowComponent> extends Component<
|
export class ActionRow<ComponentType extends MessageActionRowComponent | ModalActionRowComponent> extends Component<
|
||||||
APIActionRowComponent<APIMessageActionRowComponent | APIModalActionRowComponent>
|
APIActionRowComponent<APIComponentInMessageActionRow | APIComponentInModalActionRow>
|
||||||
> {
|
> {
|
||||||
private constructor(data: APIActionRowComponent<APIMessageActionRowComponent | APIModalActionRowComponent>);
|
private constructor(data: APIActionRowComponent<APIComponentInMessageActionRow | APIComponentInModalActionRow>);
|
||||||
public readonly components: ComponentType[];
|
public readonly components: ComponentType[];
|
||||||
public toJSON(): APIActionRowComponent<ReturnType<ComponentType['toJSON']>>;
|
public toJSON(): APIActionRowComponent<ReturnType<ComponentType['toJSON']>>;
|
||||||
}
|
}
|
||||||
@@ -697,7 +697,7 @@ export class ButtonInteraction<Cached extends CacheType = CacheType> extends Mes
|
|||||||
export type AnyComponent =
|
export type AnyComponent =
|
||||||
| APIMessageComponent
|
| APIMessageComponent
|
||||||
| APIModalComponent
|
| APIModalComponent
|
||||||
| APIActionRowComponent<APIMessageActionRowComponent | APIModalActionRowComponent>;
|
| APIActionRowComponent<APIComponentInMessageActionRow | APIComponentInModalActionRow>;
|
||||||
|
|
||||||
export class Component<RawComponentData extends AnyComponent = AnyComponent> {
|
export class Component<RawComponentData extends AnyComponent = AnyComponent> {
|
||||||
public readonly data: Readonly<RawComponentData>;
|
public readonly data: Readonly<RawComponentData>;
|
||||||
@@ -2150,9 +2150,9 @@ export class MessageComponentInteraction<Cached extends CacheType = CacheType> e
|
|||||||
public get component(): CacheTypeReducer<
|
public get component(): CacheTypeReducer<
|
||||||
Cached,
|
Cached,
|
||||||
MessageActionRowComponent,
|
MessageActionRowComponent,
|
||||||
APIMessageActionRowComponent,
|
APIComponentInMessageActionRow,
|
||||||
MessageActionRowComponent | APIMessageActionRowComponent,
|
MessageActionRowComponent | APIComponentInMessageActionRow,
|
||||||
MessageActionRowComponent | APIMessageActionRowComponent
|
MessageActionRowComponent | APIComponentInMessageActionRow
|
||||||
>;
|
>;
|
||||||
public componentType: MessageComponentType;
|
public componentType: MessageComponentType;
|
||||||
public customId: string;
|
public customId: string;
|
||||||
@@ -2354,7 +2354,7 @@ export interface ModalComponentData {
|
|||||||
customId: string;
|
customId: string;
|
||||||
title: string;
|
title: string;
|
||||||
components: readonly (
|
components: readonly (
|
||||||
| JSONEncodable<APIActionRowComponent<APIModalActionRowComponent>>
|
| JSONEncodable<APIActionRowComponent<APIComponentInModalActionRow>>
|
||||||
| ActionRowData<ModalActionRowComponentData>
|
| ActionRowData<ModalActionRowComponentData>
|
||||||
)[];
|
)[];
|
||||||
}
|
}
|
||||||
@@ -6231,9 +6231,9 @@ export interface BaseMessageOptions {
|
|||||||
| AttachmentPayload
|
| AttachmentPayload
|
||||||
)[];
|
)[];
|
||||||
components?: readonly (
|
components?: readonly (
|
||||||
| JSONEncodable<APIActionRowComponent<APIActionRowComponentTypes>>
|
| JSONEncodable<APIActionRowComponent<APIComponentInActionRow>>
|
||||||
| ActionRowData<MessageActionRowComponentData | MessageActionRowComponentBuilder>
|
| ActionRowData<MessageActionRowComponentData | MessageActionRowComponentBuilder>
|
||||||
| APIActionRowComponent<APIActionRowComponentTypes>
|
| APIActionRowComponent<APIComponentInActionRow>
|
||||||
)[];
|
)[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
"homepage": "https://discord.js.org",
|
"homepage": "https://discord.js.org",
|
||||||
"funding": "https://github.com/discordjs/discord.js?sponsor",
|
"funding": "https://github.com/discordjs/discord.js?sponsor",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"discord-api-types": "^0.37.120"
|
"discord-api-types": "^0.38.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@discordjs/api-extractor": "workspace:^",
|
"@discordjs/api-extractor": "workspace:^",
|
||||||
|
|||||||
@@ -72,7 +72,7 @@
|
|||||||
"@discordjs/rest": "workspace:^",
|
"@discordjs/rest": "workspace:^",
|
||||||
"@discordjs/util": "workspace:^",
|
"@discordjs/util": "workspace:^",
|
||||||
"@discordjs/ws": "workspace:^",
|
"@discordjs/ws": "workspace:^",
|
||||||
"discord-api-types": "^0.37.120"
|
"discord-api-types": "^0.38.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@discordjs/api-extractor": "workspace:^",
|
"@discordjs/api-extractor": "workspace:^",
|
||||||
|
|||||||
@@ -88,7 +88,7 @@
|
|||||||
"@sapphire/async-queue": "^1.5.5",
|
"@sapphire/async-queue": "^1.5.5",
|
||||||
"@sapphire/snowflake": "^3.5.5",
|
"@sapphire/snowflake": "^3.5.5",
|
||||||
"@vladfrangu/async_event_emitter": "^2.4.6",
|
"@vladfrangu/async_event_emitter": "^2.4.6",
|
||||||
"discord-api-types": "^0.37.120",
|
"discord-api-types": "^0.38.1",
|
||||||
"magic-bytes.js": "^1.10.0",
|
"magic-bytes.js": "^1.10.0",
|
||||||
"tslib": "^2.8.1",
|
"tslib": "^2.8.1",
|
||||||
"undici": "7.8.0",
|
"undici": "7.8.0",
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
import { getUserAgentAppendix } from '@discordjs/util';
|
import { getUserAgentAppendix } from '@discordjs/util';
|
||||||
|
import type { ImageSize } from 'discord-api-types/v10';
|
||||||
import { APIVersion } from 'discord-api-types/v10';
|
import { APIVersion } from 'discord-api-types/v10';
|
||||||
import { getDefaultStrategy } from '../../environment.js';
|
import { getDefaultStrategy } from '../../environment.js';
|
||||||
import type { RESTOptions, ResponseLike } from './types.js';
|
import type { RESTOptions, ResponseLike } from './types.js';
|
||||||
|
|
||||||
|
export type { ImageSize } from 'discord-api-types/v10';
|
||||||
|
|
||||||
export const DefaultUserAgent =
|
export const DefaultUserAgent =
|
||||||
`DiscordBot (https://discord.js.org, [VI]{{inject}}[/VI])` as `DiscordBot (https://discord.js.org, ${string})`;
|
`DiscordBot (https://discord.js.org, [VI]{{inject}}[/VI])` as `DiscordBot (https://discord.js.org, ${string})`;
|
||||||
|
|
||||||
@@ -48,11 +51,12 @@ export enum RESTEvents {
|
|||||||
|
|
||||||
export const ALLOWED_EXTENSIONS = ['webp', 'png', 'jpg', 'jpeg', 'gif'] as const satisfies readonly string[];
|
export const ALLOWED_EXTENSIONS = ['webp', 'png', 'jpg', 'jpeg', 'gif'] as const satisfies readonly string[];
|
||||||
export const ALLOWED_STICKER_EXTENSIONS = ['png', 'json', 'gif'] as const satisfies readonly string[];
|
export const ALLOWED_STICKER_EXTENSIONS = ['png', 'json', 'gif'] as const satisfies readonly string[];
|
||||||
export const ALLOWED_SIZES = [16, 32, 64, 128, 256, 512, 1_024, 2_048, 4_096] as const satisfies readonly number[];
|
export const ALLOWED_SIZES: readonly number[] = [
|
||||||
|
16, 32, 64, 128, 256, 512, 1_024, 2_048, 4_096,
|
||||||
|
] satisfies readonly ImageSize[];
|
||||||
|
|
||||||
export type ImageExtension = (typeof ALLOWED_EXTENSIONS)[number];
|
export type ImageExtension = (typeof ALLOWED_EXTENSIONS)[number];
|
||||||
export type StickerExtension = (typeof ALLOWED_STICKER_EXTENSIONS)[number];
|
export type StickerExtension = (typeof ALLOWED_STICKER_EXTENSIONS)[number];
|
||||||
export type ImageSize = (typeof ALLOWED_SIZES)[number];
|
|
||||||
|
|
||||||
export const OverwrittenMimeTypes = {
|
export const OverwrittenMimeTypes = {
|
||||||
// https://github.com/discordjs/discord.js/issues/8557
|
// https://github.com/discordjs/discord.js/issues/8557
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
"funding": "https://github.com/discordjs/discord.js?sponsor",
|
"funding": "https://github.com/discordjs/discord.js?sponsor",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/ws": "^8.18.1",
|
"@types/ws": "^8.18.1",
|
||||||
"discord-api-types": "^0.37.120",
|
"discord-api-types": "^0.38.1",
|
||||||
"prism-media": "^1.3.5",
|
"prism-media": "^1.3.5",
|
||||||
"tslib": "^2.8.1",
|
"tslib": "^2.8.1",
|
||||||
"ws": "^8.18.1"
|
"ws": "^8.18.1"
|
||||||
|
|||||||
@@ -79,7 +79,7 @@
|
|||||||
"@sapphire/async-queue": "^1.5.5",
|
"@sapphire/async-queue": "^1.5.5",
|
||||||
"@types/ws": "^8.18.1",
|
"@types/ws": "^8.18.1",
|
||||||
"@vladfrangu/async_event_emitter": "^2.4.6",
|
"@vladfrangu/async_event_emitter": "^2.4.6",
|
||||||
"discord-api-types": "^0.37.120",
|
"discord-api-types": "^0.38.1",
|
||||||
"tslib": "^2.8.1",
|
"tslib": "^2.8.1",
|
||||||
"ws": "^8.18.1"
|
"ws": "^8.18.1"
|
||||||
},
|
},
|
||||||
|
|||||||
44
pnpm-lock.yaml
generated
44
pnpm-lock.yaml
generated
@@ -629,8 +629,8 @@ importers:
|
|||||||
specifier: workspace:^
|
specifier: workspace:^
|
||||||
version: link:../util
|
version: link:../util
|
||||||
discord-api-types:
|
discord-api-types:
|
||||||
specifier: ^0.37.120
|
specifier: ^0.38.1
|
||||||
version: 0.37.120
|
version: 0.38.1
|
||||||
ts-mixer:
|
ts-mixer:
|
||||||
specifier: ^6.0.4
|
specifier: ^6.0.4
|
||||||
version: 6.0.4
|
version: 6.0.4
|
||||||
@@ -762,8 +762,8 @@ importers:
|
|||||||
specifier: ^2.4.6
|
specifier: ^2.4.6
|
||||||
version: 2.4.6
|
version: 2.4.6
|
||||||
discord-api-types:
|
discord-api-types:
|
||||||
specifier: ^0.37.120
|
specifier: ^0.38.1
|
||||||
version: 0.37.120
|
version: 0.38.1
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@discordjs/api-extractor':
|
'@discordjs/api-extractor':
|
||||||
specifier: workspace:^
|
specifier: workspace:^
|
||||||
@@ -902,8 +902,8 @@ importers:
|
|||||||
specifier: ^2.4.6
|
specifier: ^2.4.6
|
||||||
version: 2.4.6
|
version: 2.4.6
|
||||||
discord-api-types:
|
discord-api-types:
|
||||||
specifier: ^0.37.120
|
specifier: ^0.38.1
|
||||||
version: 0.37.120
|
version: 0.38.1
|
||||||
fast-deep-equal:
|
fast-deep-equal:
|
||||||
specifier: 3.1.3
|
specifier: 3.1.3
|
||||||
version: 3.1.3
|
version: 3.1.3
|
||||||
@@ -1030,8 +1030,8 @@ importers:
|
|||||||
packages/formatters:
|
packages/formatters:
|
||||||
dependencies:
|
dependencies:
|
||||||
discord-api-types:
|
discord-api-types:
|
||||||
specifier: ^0.37.120
|
specifier: ^0.38.1
|
||||||
version: 0.37.120
|
version: 0.38.1
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@discordjs/api-extractor':
|
'@discordjs/api-extractor':
|
||||||
specifier: workspace:^
|
specifier: workspace:^
|
||||||
@@ -1106,8 +1106,8 @@ importers:
|
|||||||
specifier: workspace:^
|
specifier: workspace:^
|
||||||
version: link:../ws
|
version: link:../ws
|
||||||
discord-api-types:
|
discord-api-types:
|
||||||
specifier: ^0.37.120
|
specifier: ^0.38.1
|
||||||
version: 0.37.120
|
version: 0.38.1
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@discordjs/api-extractor':
|
'@discordjs/api-extractor':
|
||||||
specifier: workspace:^
|
specifier: workspace:^
|
||||||
@@ -1292,8 +1292,8 @@ importers:
|
|||||||
specifier: ^2.4.6
|
specifier: ^2.4.6
|
||||||
version: 2.4.6
|
version: 2.4.6
|
||||||
discord-api-types:
|
discord-api-types:
|
||||||
specifier: ^0.37.120
|
specifier: ^0.38.1
|
||||||
version: 0.37.120
|
version: 0.38.1
|
||||||
magic-bytes.js:
|
magic-bytes.js:
|
||||||
specifier: ^1.10.0
|
specifier: ^1.10.0
|
||||||
version: 1.10.0
|
version: 1.10.0
|
||||||
@@ -1595,8 +1595,8 @@ importers:
|
|||||||
specifier: ^8.18.1
|
specifier: ^8.18.1
|
||||||
version: 8.18.1
|
version: 8.18.1
|
||||||
discord-api-types:
|
discord-api-types:
|
||||||
specifier: ^0.37.120
|
specifier: ^0.38.1
|
||||||
version: 0.37.120
|
version: 0.38.1
|
||||||
prism-media:
|
prism-media:
|
||||||
specifier: ^1.3.5
|
specifier: ^1.3.5
|
||||||
version: 1.3.5(@discordjs/opus@0.9.0(encoding@0.1.13))
|
version: 1.3.5(@discordjs/opus@0.9.0(encoding@0.1.13))
|
||||||
@@ -1686,8 +1686,8 @@ importers:
|
|||||||
specifier: ^2.4.6
|
specifier: ^2.4.6
|
||||||
version: 2.4.6
|
version: 2.4.6
|
||||||
discord-api-types:
|
discord-api-types:
|
||||||
specifier: ^0.37.120
|
specifier: ^0.38.1
|
||||||
version: 0.37.120
|
version: 0.38.1
|
||||||
tslib:
|
tslib:
|
||||||
specifier: ^2.8.1
|
specifier: ^2.8.1
|
||||||
version: 2.8.1
|
version: 2.8.1
|
||||||
@@ -8161,8 +8161,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==}
|
resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
|
||||||
discord-api-types@0.37.120:
|
discord-api-types@0.38.1:
|
||||||
resolution: {integrity: sha512-7xpNK0EiWjjDFp2nAhHXezE4OUWm7s1zhc/UXXN6hnFFU8dfoPHgV0Hx0RPiCa3ILRpdeh152icc68DGCyXYIw==}
|
resolution: {integrity: sha512-vsjsqjAuxsPhiwbPjTBeGQaDPlizFmSkU0mTzFGMgRxqCDIRBR7iTY74HacpzrDV0QtERHRKQEk1tq7drZUtHg==}
|
||||||
|
|
||||||
dmd@6.2.3:
|
dmd@6.2.3:
|
||||||
resolution: {integrity: sha512-SIEkjrG7cZ9GWZQYk/mH+mWtcRPly/3ibVuXO/tP/MFoWz6KiRK77tSMq6YQBPl7RljPtXPQ/JhxbNuCdi1bNw==}
|
resolution: {integrity: sha512-SIEkjrG7cZ9GWZQYk/mH+mWtcRPly/3ibVuXO/tP/MFoWz6KiRK77tSMq6YQBPl7RljPtXPQ/JhxbNuCdi1bNw==}
|
||||||
@@ -19962,7 +19962,7 @@ snapshots:
|
|||||||
fast-glob: 3.3.3
|
fast-glob: 3.3.3
|
||||||
is-glob: 4.0.3
|
is-glob: 4.0.3
|
||||||
minimatch: 9.0.5
|
minimatch: 9.0.5
|
||||||
semver: 7.6.3
|
semver: 7.7.1
|
||||||
ts-api-utils: 1.4.3(typescript@5.8.3)
|
ts-api-utils: 1.4.3(typescript@5.8.3)
|
||||||
typescript: 5.8.3
|
typescript: 5.8.3
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
@@ -22353,7 +22353,7 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
path-type: 4.0.0
|
path-type: 4.0.0
|
||||||
|
|
||||||
discord-api-types@0.37.120: {}
|
discord-api-types@0.38.1: {}
|
||||||
|
|
||||||
dmd@6.2.3:
|
dmd@6.2.3:
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -22952,7 +22952,7 @@ snapshots:
|
|||||||
eslint-compat-utils@0.6.5(eslint@9.24.0(jiti@2.4.2)):
|
eslint-compat-utils@0.6.5(eslint@9.24.0(jiti@2.4.2)):
|
||||||
dependencies:
|
dependencies:
|
||||||
eslint: 9.24.0(jiti@2.4.2)
|
eslint: 9.24.0(jiti@2.4.2)
|
||||||
semver: 7.6.3
|
semver: 7.7.1
|
||||||
|
|
||||||
eslint-config-neon@0.2.7(@typescript-eslint/types@8.29.0)(@typescript-eslint/utils@8.29.0(eslint@9.24.0(jiti@2.4.2))(typescript@5.5.4))(eslint-plugin-import@2.31.0(eslint-import-resolver-typescript@4.3.1)(eslint@9.24.0(jiti@2.4.2)))(eslint@9.24.0(jiti@2.4.2))(typescript@5.5.4):
|
eslint-config-neon@0.2.7(@typescript-eslint/types@8.29.0)(@typescript-eslint/utils@8.29.0(eslint@9.24.0(jiti@2.4.2))(typescript@5.5.4))(eslint-plugin-import@2.31.0(eslint-import-resolver-typescript@4.3.1)(eslint@9.24.0(jiti@2.4.2)))(eslint@9.24.0(jiti@2.4.2))(typescript@5.5.4):
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -26629,7 +26629,7 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
hosted-git-info: 4.1.0
|
hosted-git-info: 4.1.0
|
||||||
is-core-module: 2.16.1
|
is-core-module: 2.16.1
|
||||||
semver: 7.6.3
|
semver: 7.7.1
|
||||||
validate-npm-package-license: 3.0.4
|
validate-npm-package-license: 3.0.4
|
||||||
|
|
||||||
normalize-package-data@6.0.2:
|
normalize-package-data@6.0.2:
|
||||||
|
|||||||
Reference in New Issue
Block a user