mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 19:43:29 +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:
@@ -3,7 +3,7 @@
|
||||
import type {
|
||||
APITextInputComponent,
|
||||
APIActionRowComponent,
|
||||
APIActionRowComponentTypes,
|
||||
APIComponentInActionRow,
|
||||
APIChannelSelectComponent,
|
||||
APIMentionableSelectComponent,
|
||||
APIRoleSelectComponent,
|
||||
@@ -37,7 +37,7 @@ import { UserSelectMenuBuilder } from './selectMenu/UserSelectMenu.js';
|
||||
import { TextInputBuilder } from './textInput/TextInput.js';
|
||||
|
||||
export interface ActionRowBuilderData
|
||||
extends Partial<Omit<APIActionRowComponent<APIActionRowComponentTypes>, 'components'>> {
|
||||
extends Partial<Omit<APIActionRowComponent<APIComponentInActionRow>, 'components'>> {
|
||||
components: AnyActionRowComponentBuilder[];
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ export interface ActionRowBuilderData
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
@@ -90,7 +90,7 @@ export class ActionRowBuilder extends ComponentBuilder<APIActionRowComponent<API
|
||||
* .addComponents(button2, button3);
|
||||
* ```
|
||||
*/
|
||||
public constructor({ components = [], ...data }: Partial<APIActionRowComponent<APIActionRowComponentTypes>> = {}) {
|
||||
public constructor({ components = [], ...data }: Partial<APIActionRowComponent<APIComponentInActionRow>> = {}) {
|
||||
super();
|
||||
this.data = {
|
||||
...structuredClone(data),
|
||||
@@ -328,7 +328,7 @@ export class ActionRowBuilder extends ComponentBuilder<APIActionRowComponent<API
|
||||
/**
|
||||
* {@inheritDoc ComponentBuilder.toJSON}
|
||||
*/
|
||||
public override toJSON(validationOverride?: boolean): APIActionRowComponent<APIActionRowComponentTypes> {
|
||||
public override toJSON(validationOverride?: boolean): APIActionRowComponent<APIComponentInActionRow> {
|
||||
const { components, ...rest } = this.data;
|
||||
|
||||
const data = {
|
||||
@@ -338,6 +338,6 @@ export class ActionRowBuilder extends ComponentBuilder<APIActionRowComponent<API
|
||||
|
||||
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 { 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.
|
||||
*/
|
||||
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.
|
||||
|
||||
@@ -144,6 +144,36 @@ export function createComponentBuilder(
|
||||
return new MentionableSelectMenuBuilder(data);
|
||||
case ComponentType.ChannelSelect:
|
||||
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:
|
||||
// @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}`);
|
||||
|
||||
Reference in New Issue
Block a user