import { EmbedBuilder, SlashCommandBuilder } from "discord.js"; export default { name: "help", description: "Alle Befehle des Bots und Informationen zur Nutzung!", aliases: ["commands", "cmds"], guild: ["all"], nsfw: false, user_permissions: [], bot_permissions: [], args_required: 0, args_usage: "[befehlsname]", cooldown: 0, data: new SlashCommandBuilder() .setName("help") .setDescription("Zeigt alle Befehle des Bots an") .addStringOption((opt) => opt.setName("befehl").setDescription("Name eines bestimmten Befehls").setRequired(false) ), async execute(client, ctx, args) { const helpEmbed = new EmbedBuilder(); const requestedName = ctx.isSlash ? ctx.interaction.options.getString("befehl") : args?.[0]; if (!requestedName) { const commandList = `\`${Array.from(client.commands.keys()).join("` `")}\``; const { me } = ctx.guild.members; const displayName = me.displayName || client.bot.user.username; helpEmbed .setAuthor({ name: client.config.authorName, url: client.config.authorGithub }) .setColor(me.displayHexColor) .setTitle(`${displayName} Hilfe`) .setDescription(commandList) .setFooter({ text: `Nutze \`${client.config.prefix}${this.name} ${this.args_usage}\` für mehr Details!`, }); } else { const requestedCommand = requestedName.replace(client.config.prefix, ""); const command = client.commands.get(requestedCommand) || client.commands.get(client.aliases.get(requestedCommand)); if ( !command || (!command.guild.includes("all") && !command.guild.includes(ctx.guild.id)) ) return ctx.reply(`Ich konnte \`${requestedCommand}\` nicht in der Befehlsliste finden!`); helpEmbed .setTitle(`Befehl: ${command.name}`) .setDescription(command.description) .addFields([ { name: "Nutzung", value: `\`${client.config.prefix}${command.name} ${command.args_usage}\`` }, { name: "NSFW", value: `${command.nsfw}`, inline: true }, { name: "Abklingzeit", value: `${command.cooldown} Sek.`, inline: true }, ]); if (command.aliases?.length > 0) helpEmbed.addFields([{ name: "Aliasse", value: `\`${command.aliases.join("` `")}\`` }]); if (command.user_permissions?.length > 0) helpEmbed.addFields([{ name: "Berechtigungen", value: `\`${command.user_permissions.join("` `")}\`` }]); helpEmbed.setFooter({ text: `Nutze \`${client.config.prefix}${this.name}\` um alle Befehle zu sehen!` }); } return ctx.reply({ embeds: [helpEmbed] }); }, };