🎨 DNS Commands is now using guard classes

This commit is contained in:
Axel Olausson Holtenäs 2022-10-21 16:18:00 +02:00
parent be500e7f34
commit f5c988b77b
3 changed files with 8 additions and 9 deletions

View file

@ -1,20 +1,21 @@
import { SlashCommandBuilder } from "@discordjs/builders";
import { ChatInputCommandInteraction } from "discord.js";
import modules from "./modules";
export const moduleData = modules;
// Modules
import moduleLookup from "./modules/lookup";
export const builder = new SlashCommandBuilder()
.setName("dns")
.setDescription("DNS commands.")
.addSubcommand(modules.lookup.builder);
// Modules
.addSubcommand(moduleLookup.builder);
// Execute the command
export const execute = async (interaction: ChatInputCommandInteraction) => {
switch (interaction.options.getSubcommand()) {
case "lookup":
await modules.lookup.execute(interaction);
await moduleLookup.execute(interaction);
break;
default:
throw new Error(

View file

@ -1,3 +0,0 @@
import lookup from "./lookup";
export default { lookup };

View file

@ -1,11 +1,10 @@
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import axios from "axios";
import { ChatInputCommandInteraction, EmbedBuilder } from "discord.js";
import deferReply from "../../../../handlers/deferReply";
import getEmbedConfig from "../../../../helpers/getEmbedData";
export default {
metadata: { guildOnly: false, ephemeral: false },
builder: (command: SlashCommandSubcommandBuilder) => {
return command
.setName("lookup")
@ -20,6 +19,8 @@ export default {
);
},
execute: async (interaction: ChatInputCommandInteraction) => {
await deferReply(interaction, false);
const { errorColor, successColor, footerText, footerIcon } =
await getEmbedConfig(interaction.guild);
const embedTitle = "[:hammer:] Utility (Lookup)";