-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathreload.ts
More file actions
40 lines (36 loc) · 1.27 KB
/
reload.ts
File metadata and controls
40 lines (36 loc) · 1.27 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
import {
type ChatInputCommandInteraction,
MessageFlags,
PermissionFlagsBits,
SlashCommandBuilder,
} from "discord.js";
import type { DatadropClient } from "../../datadrop.js";
import type { Command } from "../../models/index.js";
export default {
data: new SlashCommandBuilder()
.setName("reload")
.setDescription("Recharge la configuration du bot")
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
ownerOnly: true,
async execute(
client: DatadropClient,
interaction: ChatInputCommandInteraction,
) {
// double check sur l'identité juste pour la sécurité
const { ownerIds } = client.config;
if (!ownerIds.includes(interaction.user.id)) {
await interaction.reply({
content:
"❌ **Oups!** - Vous n'êtes pas autorisé à utiliser cette commande.",
flags: MessageFlags.Ephemeral,
});
return;
}
client.logger.info("Rechargement de la configuration en cours...");
await client.reloadConfig();
await interaction.reply({
content: "Rechargement de la configuration en cours... 👌",
flags: MessageFlags.Ephemeral,
});
},
} as Command;