ui updates and bot updates. new commands and command handler

This commit is contained in:
2025-10-03 19:53:23 -04:00
parent 524a6cc633
commit f63fca3f1b
20 changed files with 831 additions and 125 deletions

View File

@@ -0,0 +1,25 @@
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 });
},
};