🎨 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 { SlashCommandBuilder } from "@discordjs/builders";
|
||||||
import { ChatInputCommandInteraction } from "discord.js";
|
import { ChatInputCommandInteraction } from "discord.js";
|
||||||
|
|
||||||
import modules from "./modules";
|
// Modules
|
||||||
export const moduleData = modules;
|
import modulePrune from "./modules/prune";
|
||||||
|
|
||||||
export const builder = new SlashCommandBuilder()
|
export const builder = new SlashCommandBuilder()
|
||||||
.setName("moderation")
|
.setName("moderation")
|
||||||
.setDescription("Moderation.")
|
.setDescription("Moderation.")
|
||||||
|
.setDMPermission(false)
|
||||||
|
|
||||||
.addSubcommand(modules.prune.builder);
|
.addSubcommand(modulePrune.builder);
|
||||||
|
|
||||||
// Execute the command
|
// Execute the command
|
||||||
export const execute = async (interaction: ChatInputCommandInteraction) => {
|
export const execute = async (interaction: ChatInputCommandInteraction) => {
|
||||||
switch (interaction.options.getSubcommand()) {
|
switch (interaction.options.getSubcommand()) {
|
||||||
case "prune": {
|
case "prune": {
|
||||||
await modules.prune.execute(interaction);
|
await modulePrune.execute(interaction);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
import prune from "./prune";
|
|
||||||
|
|
||||||
export default { prune };
|
|
|
@ -6,17 +6,13 @@ import {
|
||||||
EmbedBuilder,
|
EmbedBuilder,
|
||||||
PermissionsBitField,
|
PermissionsBitField,
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
|
import deferReply from "../../../../handlers/deferReply";
|
||||||
|
import checkPermission from "../../../../helpers/checkPermission";
|
||||||
// Configurations
|
// Configurations
|
||||||
import getEmbedConfig from "../../../../helpers/getEmbedData";
|
import getEmbedConfig from "../../../../helpers/getEmbedData";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default {
|
export default {
|
||||||
metadata: {
|
|
||||||
guildOnly: true,
|
|
||||||
ephemeral: false,
|
|
||||||
permissions: [PermissionsBitField.Flags.ManageMessages],
|
|
||||||
},
|
|
||||||
|
|
||||||
builder: (command: SlashCommandSubcommandBuilder) => {
|
builder: (command: SlashCommandSubcommandBuilder) => {
|
||||||
return command
|
return command
|
||||||
.setName("prune")
|
.setName("prune")
|
||||||
|
@ -32,6 +28,13 @@ export default {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
execute: async (interaction: ChatInputCommandInteraction) => {
|
execute: async (interaction: ChatInputCommandInteraction) => {
|
||||||
|
await deferReply(interaction, false);
|
||||||
|
|
||||||
|
await checkPermission(
|
||||||
|
interaction,
|
||||||
|
PermissionsBitField.Flags.ManageMessages
|
||||||
|
);
|
||||||
|
|
||||||
const { errorColor, footerText, footerIcon } = await getEmbedConfig(
|
const { errorColor, footerText, footerIcon } = await getEmbedConfig(
|
||||||
interaction.guild
|
interaction.guild
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue