mirror of
https://github.com/arthur-pbty/gestion-perso.git
synced 2026-06-19 13:46:57 +02:00
ad help
This commit is contained in:
@@ -0,0 +1,89 @@
|
|||||||
|
const { EmbedBuilder, StringSelectMenuBuilder, ActionRowBuilder } = require("discord.js")
|
||||||
|
/*
|
||||||
|
module.exports = {
|
||||||
|
aliases: ['h', 'aide'],
|
||||||
|
description: 'Affiche la liste des commandes',
|
||||||
|
emote: '📚',
|
||||||
|
utilisation: '[commande]',
|
||||||
|
|
||||||
|
async execute(message, args, client) {
|
||||||
|
console.log("Liste des commandes :");
|
||||||
|
let commands = [];
|
||||||
|
for (const command of client.commands.values()) {
|
||||||
|
const existingCommand = commands.find(cmd => cmd.name === command.name);
|
||||||
|
if (!existingCommand) {
|
||||||
|
commands.push(command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(commands);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
aliases: ['h', 'aide'],
|
||||||
|
description: 'Affiche la liste des commandes',
|
||||||
|
emote: '📚',
|
||||||
|
utilisation: '[commande]',
|
||||||
|
|
||||||
|
async execute(message, args, client) {
|
||||||
|
const prefix = '+'
|
||||||
|
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 commandPerm = 'None'
|
||||||
|
|
||||||
|
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: `\`${prefix}${command.utilisation ? `${command.utilisation}` : ''}\``, inline: true },
|
||||||
|
{ name: 'Catégorie', value: command.category || 'Non spécifiée', inline: true },
|
||||||
|
{ name: 'Alias', value: command.aliases ? command.aliases.map(alias => `\`${alias}\``).join(', ') : 'Aucun', inline: true },
|
||||||
|
{ name: 'Permissions', value: `Perm level: ${commandPerm}` || 'Indéfini', inline: true },
|
||||||
|
)
|
||||||
|
.setTimestamp()
|
||||||
|
.setFooter({text: `${client.user.tag} © 2024`, iconURL: client.user.displayAvatarURL({dynamic: true})})
|
||||||
|
|
||||||
|
return message.reply({ embeds: [embed_command] });
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
let commands = [];
|
||||||
|
for (const command of client.commands.values()) {
|
||||||
|
const existingCommand = commands.find(cmd => cmd.name === command.name);
|
||||||
|
if (!existingCommand) {
|
||||||
|
commands.push(command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let categories = {};
|
||||||
|
commands.forEach((command) => {
|
||||||
|
if (!categories[command.category]) {
|
||||||
|
categories[command.category] = [];
|
||||||
|
}
|
||||||
|
categories[command.category].push(command);
|
||||||
|
});
|
||||||
|
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setTitle('Liste des commandes')
|
||||||
|
.setDescription('Sélectionnez une catégorie parmi les options ci-dessous pour obtenir de l\'aide sur les commandes correspondantes.')
|
||||||
|
.setColor('#0099ff');
|
||||||
|
|
||||||
|
for (const [category, commands] of Object.entries(categories)) {
|
||||||
|
embed.addFields({
|
||||||
|
name: `Catégorie ${category}`,
|
||||||
|
value: commands.map(command => `\`${command.name}\` - ${command.description}`).join('\n')
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
message.channel.send({ embeds: [embed] });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
const { ButtonStyle, ButtonBuilder, ActionRowBuilder } = require('discord.js');
|
const { ButtonStyle, ButtonBuilder, ActionRowBuilder } = require('discord.js');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'ping',
|
|
||||||
aliases: ['latence'],
|
aliases: ['latence'],
|
||||||
description: 'Avoir la latence du bot.',
|
description: 'Avoir la latence du bot.',
|
||||||
emote: '⏱️',
|
emote: '⏱️',
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ const sqlite3 = require('sqlite3').verbose();
|
|||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'setprefix',
|
|
||||||
aliases: ['prefixset'],
|
aliases: ['prefixset'],
|
||||||
description: 'Changer le préfixe du bot.',
|
description: 'Changer le préfixe du bot.',
|
||||||
emote: '⏱️',
|
emote: '⏱️',
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ module.exports = {
|
|||||||
if (permissionLevel < command.permission) return message.reply("Vous n'avez pas la permission d'utiliser cette commande");
|
if (permissionLevel < command.permission) return message.reply("Vous n'avez pas la permission d'utiliser cette commande");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
command.execute(message, args);
|
command.execute(message, args, client);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
message.reply("Erreur lors de l'exécution de la commande");
|
message.reply("Erreur lors de l'exécution de la commande");
|
||||||
|
|||||||
@@ -12,7 +12,11 @@ module.exports = function loadEvents(client, dir) {
|
|||||||
try {
|
try {
|
||||||
delete require.cache[require.resolve(filePath)];
|
delete require.cache[require.resolve(filePath)];
|
||||||
const command = require(filePath);
|
const command = require(filePath);
|
||||||
client.commands.set(command.name, command);
|
const fileName = file.replace('.js', '');
|
||||||
|
command.name = fileName;
|
||||||
|
const parentDir = path.basename(path.dirname(filePath));
|
||||||
|
command.category = parentDir === 'commands' ? 'other' : parentDir;
|
||||||
|
client.commands.set(fileName, command);
|
||||||
if (command.aliases) {
|
if (command.aliases) {
|
||||||
command.aliases.forEach(alias => {
|
command.aliases.forEach(alias => {
|
||||||
client.commands.set(alias, command);
|
client.commands.set(alias, command);
|
||||||
|
|||||||
Reference in New Issue
Block a user