🖥️
Discord Base
  • Welcome
  • Getting Started
    • Quickstart
  • Templates
    • Command
    • Events
    • Component
    • Route
  • Utilities
    • Colors
    • Logger
    • Remote MySQL
    • Local MySQL
    • Query Builder
  • DataTypes
    • Commands
    • Events
    • Routes
Powered by GitBook
On this page
  • Decorator
  • Template
  • Automatic types
  1. Templates

Component

You can create new components in app/component

Decorator

parameter
type
required

id

string

type

type ComponentType = "modal" | "button" | "select" | "text-input";

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

You can use Automatic<T> instead of any

interaction: Automatic<"select"> // all types from ComponentType are available

Is the same with

interaction: StringSelectMenuInteraction
PreviousEventsNextRoute

Last updated 8 months ago

ComponentType