blob: ad997238e393e9aaaffe9b694f5981bdaa1bbdcc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import { SlashCommandBuilder, PermissionFlagsBits, MessageFlags } from "discord.js";
import fs from "fs";
export default {
data: new SlashCommandBuilder()
.setName("clear-cache")
.setDescription(
"Clears the bot's cache.",
)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
execute: async (interaction) => {
const cacheDir = ".cache";
if (fs.existsSync(cacheDir)) {
fs.rmSync(cacheDir, { recursive: true, force: true });
await interaction.reply({
content: "Cache cleared successfully.",
flags: MessageFlags.Ephemeral,
});
} else {
await interaction.reply({
content: "Cache directory does not exist.",
flags: MessageFlags.Ephemeral,
});
}
},
};
|