Implement /quote
This commit is contained in:
41
commands/quotes/quote.ts
Normal file
41
commands/quotes/quote.ts
Normal 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()");
|
||||
}
|
||||
Reference in New Issue
Block a user