mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-03 23:36:35 +02:00
add prefix changeble with serveur and main prefix configurable
This commit is contained in:
+11
-3
@@ -1,4 +1,6 @@
|
||||
const { EmbedBuilder, StringSelectMenuBuilder, ActionRowBuilder } = require("discord.js")
|
||||
const db = require('quick.db');
|
||||
const GestionDb = new db.table("gestion");
|
||||
module.exports = {
|
||||
name: 'help',
|
||||
description: 'Affiche la liste des commandes',
|
||||
@@ -6,18 +8,24 @@ module.exports = {
|
||||
emote: '📚',
|
||||
utilisation: 'help [commande]',
|
||||
async execute(message, args, client) {
|
||||
const defaultprefix = "+";
|
||||
const botId = client.user.id;
|
||||
const guildId = message.guild.id;
|
||||
let mainPrefix = await GestionDb.get(`${botId}.prefix`);
|
||||
let serverPrefix = await GestionDb.get(`${botId}.${guildId}.prefix`);
|
||||
const prefix = serverPrefix !== undefined ? serverPrefix : mainPrefix !== undefined ? mainPrefix : defaultprefix;
|
||||
if (args[0]) {
|
||||
const command = client.commands.get(args[0]);
|
||||
if (!command) {
|
||||
return message.reply(`Je n'ai pas trouvé de commande nommée "${args[0]}".`);
|
||||
}
|
||||
|
||||
|
||||
const embed_command = new EmbedBuilder()
|
||||
.setColor('#0099ff')
|
||||
.setTitle(`Aide pour la commande ${command.emote ? ` ${command.emote}` : '🔧'} ${command.name}`)
|
||||
.setDescription(command.description)
|
||||
.addFields(
|
||||
{ name: 'Utilisation', value: `\`+${command.utilisation ? ` **${command.utilisation}**` : ''}\``, inline: true },
|
||||
{ name: 'Utilisation', value: `\`${prefix}${command.utilisation ? ` **${command.utilisation}**` : ''}\``, inline: true },
|
||||
{ name: 'Catégorie', value: command.category || 'Non spécifiée', inline: true }
|
||||
);
|
||||
|
||||
@@ -59,7 +67,7 @@ module.exports = {
|
||||
for (const [category, commands] of Object.entries(categories)) {
|
||||
let description;
|
||||
if (commands.length > 0) {
|
||||
description = commands.map(command => `${command.emote ? ` ${command.emote}` : '🔧'} **+${command.utilisation ? ` ${command.utilisation}` : ''}**\n \`${command.description}\``).join('\n');
|
||||
description = commands.map(command => `${command.emote ? ` ${command.emote}` : '🔧'} **${prefix}${command.utilisation ? ` ${command.utilisation}` : ''}**\n \`${command.description}\``).join('\n');
|
||||
} else {
|
||||
description = 'Aucune commande dans cette catégorie.';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user