42 lines
920 B
TypeScript
42 lines
920 B
TypeScript
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()");
|
|
}
|