Implement /quote

This commit is contained in:
2025-07-04 07:01:18 -04:00
parent c2029290d2
commit 1aaaef2a81
2 changed files with 212 additions and 0 deletions

41
commands/quotes/quote.ts Normal file
View File

@@ -0,0 +1,41 @@
import {
SlashCommandBuilder,
TextChannel,
type ChatInputCommandInteraction,
type Client,
type InviteStageInstance,
} from "discord.js";
import type { Sequelize } from "sequelize";
import { quotes } from "./quotes.json";
async function execute(interaction: ChatInputCommandInteraction) {
try {
const index = Math.floor(Math.random() * quotes.length);
await interaction.reply?.({
content: `> *${quotes[index].quote}*
> — ${quotes[index].author}`,
});
} catch (error) {
console.error(`Problem sending to channel: ${error}`);
}
}
async function initialize() {}
export default function (settings: {}) {
return {
data: new SlashCommandBuilder()
.setName("quote")
.setDescription("Print a quote from League of Legends."),
initialize: initialize,
execute: execute,
};
}
try {
await (value as ClassA).foo();
} catch (error) {
console.log("Type error while running value.foo()");
}