const { SlashCommandBuilder } = require('discord.js'); module.exports = { name: 'help', description: 'List available bot commands and what they do.', enabled: true, builder: new SlashCommandBuilder() .setName('help') .setDescription('List available bot commands and what they do.'), async execute(interaction) { const commands = Array.from(interaction.client.commands.values()).filter(cmd => !!cmd.builder); let text = '**Available Commands:**\n\n'; const db = require('../../backend/db').readDb(); const guildSettings = db[interaction.guildId] || {}; const toggles = guildSettings.commandToggles || {}; const protectedCommands = ['manage-commands', 'help']; for (const cmd of commands) { const isEnabled = protectedCommands.includes(cmd.name) ? true : (toggles[cmd.name] !== false && cmd.enabled !== false); text += `/${cmd.name} — ${cmd.description || 'No description.'} — ${isEnabled ? 'Enabled' : 'Disabled'}${protectedCommands.includes(cmd.name) ? ' (locked)' : ''}\n`; } await interaction.reply({ content: text, flags: 64 }); }, };