🎨 Moderation Command is now using guard classes
This commit is contained in:
parent
4606392189
commit
db9c05c2e9
3 changed files with 14 additions and 13 deletions
|
@ -1,20 +1,21 @@
|
|||
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||
import { ChatInputCommandInteraction } from "discord.js";
|
||||
|
||||
import modules from "./modules";
|
||||
export const moduleData = modules;
|
||||
// Modules
|
||||
import modulePrune from "./modules/prune";
|
||||
|
||||
export const builder = new SlashCommandBuilder()
|
||||
.setName("moderation")
|
||||
.setDescription("Moderation.")
|
||||
.setDMPermission(false)
|
||||
|
||||
.addSubcommand(modules.prune.builder);
|
||||
.addSubcommand(modulePrune.builder);
|
||||
|
||||
// Execute the command
|
||||
export const execute = async (interaction: ChatInputCommandInteraction) => {
|
||||
switch (interaction.options.getSubcommand()) {
|
||||
case "prune": {
|
||||
await modules.prune.execute(interaction);
|
||||
await modulePrune.execute(interaction);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
import prune from "./prune";
|
||||
|
||||
export default { prune };
|
|
@ -6,17 +6,13 @@ import {
|
|||
EmbedBuilder,
|
||||
PermissionsBitField,
|
||||
} from "discord.js";
|
||||
import deferReply from "../../../../handlers/deferReply";
|
||||
import checkPermission from "../../../../helpers/checkPermission";
|
||||
// Configurations
|
||||
import getEmbedConfig from "../../../../helpers/getEmbedData";
|
||||
|
||||
// Function
|
||||
export default {
|
||||
metadata: {
|
||||
guildOnly: true,
|
||||
ephemeral: false,
|
||||
permissions: [PermissionsBitField.Flags.ManageMessages],
|
||||
},
|
||||
|
||||
builder: (command: SlashCommandSubcommandBuilder) => {
|
||||
return command
|
||||
.setName("prune")
|
||||
|
@ -32,6 +28,13 @@ export default {
|
|||
);
|
||||
},
|
||||
execute: async (interaction: ChatInputCommandInteraction) => {
|
||||
await deferReply(interaction, false);
|
||||
|
||||
await checkPermission(
|
||||
interaction,
|
||||
PermissionsBitField.Flags.ManageMessages
|
||||
);
|
||||
|
||||
const { errorColor, footerText, footerIcon } = await getEmbedConfig(
|
||||
interaction.guild
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue