mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-04 14:06:07 +00:00

Co-authored-by: Yuzu <yuzuru@programmer.net> Co-authored-by: Nicolás Serna <nicolito128@hotmail.com> * compat: replace the mixer Co-authored-by: Marcos Susaña <66887817+socram03@users.noreply.github.com> Co-authored-by: Nicolás Serna <nicolito128@hotmail.com>
33 lines
862 B
TypeScript
33 lines
862 B
TypeScript
import type { DiscordActionRow, MessageComponentTypes } from "../../../../discordeno/mod.ts";
|
|
import type { ComponentBuilder } from "../../../Util.ts";
|
|
|
|
export class ActionRowBuilder<T extends ComponentBuilder> {
|
|
constructor() {
|
|
this.components = [] as T[];
|
|
this.type = 1;
|
|
}
|
|
components: T[];
|
|
type: MessageComponentTypes.ActionRow;
|
|
|
|
addComponents(...components: T[]) {
|
|
this.components.push(...components);
|
|
return this;
|
|
}
|
|
|
|
setComponents(...components: T[]) {
|
|
this.components.splice(
|
|
0,
|
|
this.components.length,
|
|
...components,
|
|
);
|
|
return this;
|
|
}
|
|
|
|
toJSON(): DiscordActionRow {
|
|
return {
|
|
type: this.type,
|
|
components: this.components.map((c) => c.toJSON()) as DiscordActionRow["components"],
|
|
};
|
|
}
|
|
}
|