From 3c8e005405b52f44f0ad32952590a97bc70d3a34 Mon Sep 17 00:00:00 2001 From: Chris Ham <431647+greenham@users.noreply.github.com> Date: Sat, 16 Aug 2025 20:33:43 -0700 Subject: [PATCH] Fix role configuration database persistence issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix /config roles add/remove commands not saving to database - Prevent upsertGuildConfig from overwriting direct database role updates - Add early return for role management to skip general config update - Ensure role IDs are properly persisted when using /config roles commands - Add proper success feedback and logging for role configuration changes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/commands/slash/config.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/commands/slash/config.js b/src/commands/slash/config.js index 25dd8e3..cfd5c76 100644 --- a/src/commands/slash/config.js +++ b/src/commands/slash/config.js @@ -264,8 +264,18 @@ module.exports = { updateMessage = `Removed **${role.name}** from self-assignable roles`; } - updated = true; - break; + // Don't set updated = true here since we're calling database methods directly + // Skip the upsertGuildConfig call at the end + const embed = new EmbedBuilder() + .setTitle('✅ Configuration Updated') + .setColor(0x00ff00) + .setDescription(updateMessage) + .setFooter({ text: 'Use /config show to see all settings' }); + + await interaction.reply({ embeds: [embed] }); + + console.log(`Role configuration updated for ${interaction.guild.name}: ${action} ${role.name}`); + return; } // Update configuration in database