mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 20:43:30 +01:00
refactor: make data public in builders (#7486)
This commit is contained in:
@@ -15,6 +15,9 @@ export type ActionRowComponent = ButtonComponent | SelectMenuComponent;
|
|||||||
export class ActionRow<T extends ActionRowComponent = ActionRowComponent> extends Component<
|
export class ActionRow<T extends ActionRowComponent = ActionRowComponent> extends Component<
|
||||||
Omit<Partial<APIActionRowComponent<APIMessageComponent>> & { type: ComponentType.ActionRow }, 'components'>
|
Omit<Partial<APIActionRowComponent<APIMessageComponent>> & { type: ComponentType.ActionRow }, 'components'>
|
||||||
> {
|
> {
|
||||||
|
/**
|
||||||
|
* The components within this action row
|
||||||
|
*/
|
||||||
public readonly components: T[];
|
public readonly components: T[];
|
||||||
|
|
||||||
public constructor({ components, ...data }: Partial<APIActionRowComponent<APIMessageComponent>> = {}) {
|
public constructor({ components, ...data }: Partial<APIActionRowComponent<APIMessageComponent>> = {}) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export abstract class Component<
|
|||||||
/**
|
/**
|
||||||
* The API data associated with this component
|
* The API data associated with this component
|
||||||
*/
|
*/
|
||||||
protected readonly data: DataType;
|
public readonly data: DataType;
|
||||||
|
|
||||||
public abstract toJSON(): APIMessageComponent;
|
public abstract toJSON(): APIMessageComponent;
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ import isEqual from 'fast-deep-equal';
|
|||||||
export class UnsafeSelectMenuComponent extends Component<
|
export class UnsafeSelectMenuComponent extends Component<
|
||||||
Partial<Omit<APISelectMenuComponent, 'options'>> & { type: ComponentType.SelectMenu }
|
Partial<Omit<APISelectMenuComponent, 'options'>> & { type: ComponentType.SelectMenu }
|
||||||
> {
|
> {
|
||||||
|
/**
|
||||||
|
* The options within this select menu
|
||||||
|
*/
|
||||||
public readonly options: UnsafeSelectMenuOption[];
|
public readonly options: UnsafeSelectMenuOption[];
|
||||||
|
|
||||||
public constructor(data?: Partial<APISelectMenuComponent>) {
|
public constructor(data?: Partial<APISelectMenuComponent>) {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export interface EmbedImageData extends Omit<APIEmbedImage, 'proxy_url'> {
|
|||||||
* Represents a non-validated embed in a message (image/video preview, rich embed, etc.)
|
* Represents a non-validated embed in a message (image/video preview, rich embed, etc.)
|
||||||
*/
|
*/
|
||||||
export class UnsafeEmbed implements Equatable<APIEmbed | UnsafeEmbed> {
|
export class UnsafeEmbed implements Equatable<APIEmbed | UnsafeEmbed> {
|
||||||
protected data: APIEmbed;
|
public readonly data: APIEmbed;
|
||||||
|
|
||||||
public constructor(data: APIEmbed = {}) {
|
public constructor(data: APIEmbed = {}) {
|
||||||
this.data = { ...data };
|
this.data = { ...data };
|
||||||
|
|||||||
Reference in New Issue
Block a user