Skip to content

Commit

Permalink
refactor: make data public in builders
Browse files Browse the repository at this point in the history
  • Loading branch information
suneettipirneni committed Feb 17, 2022
1 parent dee27db commit 150780f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packages/builders/src/components/ActionRow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ export type ActionRowComponent = ButtonComponent | SelectMenuComponent;
export class ActionRow<T extends ActionRowComponent = ActionRowComponent> extends Component<
Omit<Partial<APIActionRowComponent<APIMessageComponent>> & { type: ComponentType.ActionRow }, 'components'>
> {
/**
* The components within this action row
*/
public readonly components: T[];

public constructor({ components, ...data }: Partial<APIActionRowComponent<APIMessageComponent>> = {}) {
Expand Down
2 changes: 1 addition & 1 deletion packages/builders/src/components/Component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export abstract class Component<
/**
* The API data associated with this component
*/
protected readonly data: DataType;
public readonly data: DataType;

/**
* Converts this component to an API-compatible JSON object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import { UnsafeSelectMenuOption } from './UnsafeSelectMenuOption';
export class UnsafeSelectMenuComponent extends Component<
Partial<Omit<APISelectMenuComponent, 'options'>> & { type: ComponentType.SelectMenu }
> {
/**
* The options within this select menu
*/
public readonly options: UnsafeSelectMenuOption[];

public constructor(data?: Partial<APISelectMenuComponent>) {
Expand Down
5 changes: 4 additions & 1 deletion packages/builders/src/messages/embed/UnsafeEmbed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ export interface EmbedImageData extends Omit<APIEmbedImage, 'proxy_url'> {
* Represents a non-validated embed in a message (image/video preview, rich embed, etc.)
*/
export class UnsafeEmbed {
protected data: APIEmbed;
/**
* The API data associated with this embed
*/
public readonly data: APIEmbed;

public constructor(data: APIEmbed = {}) {
this.data = { ...data };
Expand Down

0 comments on commit 150780f

Please sign in to comment.