Component
You can create new components in app/component
Decorator
Decorator
parameter
type
required
id
string
type
type ComponentType = "modal" | "button" | "select" | "text-input";
Template
Template
import { Client } from "discord.js";
import { Component, Automatic } from "engine";
@Component("my_select_menu", "select")
export default class MySelectMenuComponent {
public static async callback(client: Client, interaction: Automatic<"select">) {
const selectedValue = interaction.values[0];
await interaction.reply(`You selected ${selectedValue}!`);
}
}
Automatic types
Automatic types
interaction: Automatic<"select"> // all types from ComponentType are available
Is the same with
interaction: StringSelectMenuInteraction
Last updated