From cb19e0f788155c2157b86b608cfffb6b402bce3c Mon Sep 17 00:00:00 2001 From: Vermium Sifell Date: Fri, 21 Oct 2022 16:33:31 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Fun=20Command=20is=20now=20using?= =?UTF-8?q?=20guard=20classes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/commands/fun/index.ts | 9 ++++----- src/commands/fun/modules/index.ts | 5 ----- src/commands/fun/modules/meme/index.ts | 8 ++++++-- 3 files changed, 10 insertions(+), 12 deletions(-) delete mode 100644 src/commands/fun/modules/index.ts diff --git a/src/commands/fun/index.ts b/src/commands/fun/index.ts index 8c166f0..e010d5d 100644 --- a/src/commands/fun/index.ts +++ b/src/commands/fun/index.ts @@ -2,21 +2,20 @@ import { SlashCommandBuilder } from "@discordjs/builders"; import { ChatInputCommandInteraction } from "discord.js"; import logger from "../../middlewares/logger"; -import modules from "./modules"; +// Modules +import moduleMeme from "./modules/meme"; export const builder = new SlashCommandBuilder() .setName("fun") .setDescription("Fun commands.") - .addSubcommand(modules.meme.builder); - -export const moduleData = modules; + .addSubcommand(moduleMeme.builder); export const execute = async (interaction: ChatInputCommandInteraction) => { const { options } = interaction; if (options.getSubcommand() === "meme") { - await modules.meme.execute(interaction); + await moduleMeme.execute(interaction); } else { logger.silly(`Unknown subcommand ${options.getSubcommand()}`); } diff --git a/src/commands/fun/modules/index.ts b/src/commands/fun/modules/index.ts deleted file mode 100644 index 53aeddc..0000000 --- a/src/commands/fun/modules/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import meme from "./meme"; - -export default { - meme, -}; diff --git a/src/commands/fun/modules/meme/index.ts b/src/commands/fun/modules/meme/index.ts index b5c3db3..1ed1ea0 100644 --- a/src/commands/fun/modules/meme/index.ts +++ b/src/commands/fun/modules/meme/index.ts @@ -1,16 +1,20 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; import axios from "axios"; import { CommandInteraction, EmbedBuilder } from "discord.js"; +import { command as CooldownCommand } from "../../../../handlers/cooldown"; +import deferReply from "../../../../handlers/deferReply"; import getEmbedConfig from "../../../../helpers/getEmbedData"; export default { - metadata: { guildOnly: false, ephemeral: false, cooldown: 15 }, - builder: (command: SlashCommandSubcommandBuilder) => { return command.setName("meme").setDescription("Get a meme from r/memes)"); }, execute: async (interaction: CommandInteraction) => { + await deferReply(interaction, false); + + await CooldownCommand(interaction, 15); + const { guild } = interaction; const embedConfig = await getEmbedConfig(guild);