crv2/util/DiscordInteractionCommand.ts

34 lines
971 B
TypeScript

import { SlashCommandBuilder, ChatInputCommandInteraction } from "discord.js";
import { guildID } from "../config.json";
export interface DiscordInteractionCommandSkeleton {
GUILD_ID: string;
builder?: SlashCommandBuilder;
description: string;
execute: (interaction: ChatInputCommandInteraction) => Error | Promise<void | any>;
name: string;
}
export default abstract class DiscordInteractionCommand
implements DiscordInteractionCommandSkeleton
{
public name: string;
public description: string;
public builder: SlashCommandBuilder;
public GUILD_ID: string;
protected constructor(name: string, description: string) {
this.name = name;
this.description = description;
this.builder = new SlashCommandBuilder();
this.builder.setName(this.name);
this.builder.setDescription(this.description);
this.GUILD_ID = guildID;
}
public abstract execute(interaction: ChatInputCommandInteraction): Error | Promise<void | any>;
}