seyfert/src/components/ActionRow.ts
2024-03-27 23:10:19 -04:00

22 lines
662 B
TypeScript

import type { APIMessageActionRowComponent, ComponentType } from 'discord-api-types/v10';
import { BaseComponent } from './BaseComponent';
import type { ActionRowMessageComponents } from './index';
import { componentFactory } from './index';
export class MessageActionRowComponent<
T extends ActionRowMessageComponents,
> extends BaseComponent<ComponentType.ActionRow> {
private ComponentsFactory: T[];
constructor(data: {
type: ComponentType.ActionRow;
components: APIMessageActionRowComponent[];
}) {
super(data);
this.ComponentsFactory = data.components.map(componentFactory) as T[];
}
get components() {
return this.ComponentsFactory;
}
}