From c5796aaf7d1357abbc1ea76455e61588da510571 Mon Sep 17 00:00:00 2001 From: Yuto Nishida Date: Mon, 7 Sep 2026 14:17:11 -0700 Subject: [PATCH] [yutobot-discord] Always reply from permission-gated commands foocheck and owoifier previously returned silently when the invoking user lacked the required permission, and foocheck's catch only logged to the console -- so some callers got no response at all. Every branch now replies: a "you need the perm `X` to run this command :(" notice on a user-permission denial, and a "sry, foocheck broke" message when the member fetch throws. The bot's own missing-permission wording (`X` perm missing!) is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01QaRcUCq39o8hvEwcuH6foZ --- yutobot-discord/src/modules/yutobot/commands.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/yutobot-discord/src/modules/yutobot/commands.js b/yutobot-discord/src/modules/yutobot/commands.js index 3187600..7dfe030 100644 --- a/yutobot-discord/src/modules/yutobot/commands.js +++ b/yutobot-discord/src/modules/yutobot/commands.js @@ -47,7 +47,10 @@ const logicCommands = [ name: "foocheck", description: "List members who don't have the `foo` role (needs Manage Roles)", execute: async ({ message }) => { - if (!message.member.hasPermission("MANAGE_ROLES")) return; + if (!message.member.hasPermission("MANAGE_ROLES")) { + message.channel.send("you need the perm `Manage Roles` to run this command :("); + return; + } try { const allMembers = (await message.guild.members.fetch()).array().filter(member => !member.user.bot); const allMembersWithoutFoo = allMembers.filter(member => !member.roles.cache.array().some(role => role.name === "foo")); @@ -57,6 +60,7 @@ const logicCommands = [ } catch (err) { console.error("foocheck failed."); console.error(err); + message.channel.send("sry, foocheck broke ¯\\_(ツ)_/¯"); } }, }, @@ -64,7 +68,10 @@ const logicCommands = [ name: "owoifier", description: "Toggle the random owoifier (needs Administrator)", execute: ({ message, state }) => { - if (!message.member.hasPermission("ADMINISTRATOR")) return; + if (!message.member.hasPermission("ADMINISTRATOR")) { + message.channel.send("you need the perm `Administrator` to run this command :("); + return; + } state.owoifierEnabled = !state.owoifierEnabled; message.channel.send(state.owoifierEnabled ? "1" : "0"); }, -- 2.51.2