25 lines
No EOL
820 B
TypeScript
25 lines
No EOL
820 B
TypeScript
import {SlashCommandBuilder, CommandInteraction} from "discord.js";
|
|
import {Command} from "./Command";
|
|
|
|
export class HelloWorldCommand implements Command {
|
|
private static RESPONSES: string[] = [
|
|
'Hello :)',
|
|
'zzzZ... ZzzzZ... huh? I am awake. I am awake!',
|
|
'Roll for initiative!',
|
|
'I was an adventurer like you...',
|
|
'Hello :) How are you?',
|
|
]
|
|
|
|
definition(): SlashCommandBuilder {
|
|
return new SlashCommandBuilder()
|
|
.setName("hello")
|
|
.setDescription("Displays a random response. (commonly used to test if the bot is online)")
|
|
}
|
|
|
|
async execute(interaction: CommandInteraction): Promise<void> {
|
|
const random = Math.floor(Math.random() * HelloWorldCommand.RESPONSES.length);
|
|
|
|
await interaction.reply(HelloWorldCommand.RESPONSES[random]);
|
|
return Promise.resolve();
|
|
}
|
|
} |