🎨 Fun Command is now using guard classes
This commit is contained in:
parent
f5c988b77b
commit
cb19e0f788
3 changed files with 10 additions and 12 deletions
|
@ -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()}`);
|
||||
}
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
import meme from "./meme";
|
||||
|
||||
export default {
|
||||
meme,
|
||||
};
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue