From 3df56f1fc25ed8bf7c888ec93f45b9dbc5bc9a42 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 7 Apr 2026 19:31:55 +0000 Subject: [PATCH] Task #98: Add role automation to scope MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Create/delete server roles alongside channels - Add reaction to role selection message - Updated command syntax: !createserver "Name" 🎮 - Delete command now removes role + channels Chronicler #66 --- .../task-098-discord-channel-automation.md | 59 +++++++++++++++---- 1 file changed, 46 insertions(+), 13 deletions(-) diff --git a/docs/tasks/task-098-discord-channel-automation.md b/docs/tasks/task-098-discord-channel-automation.md index ef578ae..b9d3f11 100644 --- a/docs/tasks/task-098-discord-channel-automation.md +++ b/docs/tasks/task-098-discord-channel-automation.md @@ -18,8 +18,10 @@ When a new Minecraft server is added, Holly must manually create: 5. Voice channel: `voice` 6. Set permissions on all channels 7. Position everything under the Servers category +8. Create a server role for reaction-role assignment +9. Add reaction emoji to the role selection message -With 20 servers, this is 100+ manual actions. Each new server adds 5 more. +With 20 servers, this is 100+ manual actions. Each new server adds 7 more. --- @@ -43,7 +45,8 @@ Automate Discord channel creation via the Discord API. **Discord Bot Permissions Needed:** - Manage Channels -- Manage Roles (if setting permissions) +- Manage Roles +- Add Reactions (for role selection message) **Arbiter already has a Discord bot** — just needs these permissions granted in Discord server settings. @@ -51,6 +54,9 @@ Automate Discord channel creation via the Discord API. - `POST /guilds/{guild.id}/channels` — Create channel - `PATCH /channels/{channel.id}` — Modify channel (position, permissions) - `DELETE /channels/{channel.id}` — Delete channel (for retirement) +- `POST /guilds/{guild.id}/roles` — Create role +- `DELETE /guilds/{guild.id}/roles/{role.id}` — Delete role (for retirement) +- `PUT /channels/{channel.id}/messages/{message.id}/reactions/{emoji}/@me` — Add reaction to role selection message **Channel Types:** - `0` = Text (chat, in-game-chat) @@ -64,18 +70,27 @@ Automate Discord channel creation via the Discord API. ```javascript // Pseudocode for !createserver command -async function createServerChannels(serverName) { +async function createServerChannels(serverName, emoji) { const guild = /* get guild */; const serversCategory = /* find "Servers" category */; + const roleSelectionChannelId = /* role selection channel */; + const roleSelectionMessageId = /* the reaction role message */; - // 1. Create category for this server + // 1. Create role for this server + const role = await guild.roles.create({ + name: serverName, + mentionable: true, + reason: `Server role for ${serverName}` + }); + + // 2. Create category for this server const category = await guild.channels.create({ name: serverName, type: 4, // Category parent: serversCategory.id }); - // 2. Create channels under category + // 3. Create channels under category const channels = [ { name: 'chat', type: 0 }, { name: 'in-game-chat', type: 0 }, @@ -91,36 +106,54 @@ async function createServerChannels(serverName) { }); } - return `Created ${serverName} with 4 channels`; + // 4. Add reaction to role selection message + const roleChannel = await guild.channels.fetch(roleSelectionChannelId); + const roleMessage = await roleChannel.messages.fetch(roleSelectionMessageId); + await roleMessage.react(emoji); + + // 5. Configure reaction role bot (Carl-bot API or manual step) + // Note: May require manual mapping in bot dashboard + + return `Created ${serverName}: role + category + 4 channels + reaction`; } ``` +**Command syntax:** +``` +!createserver "Stoneblock 4" 🪨 +!deleteserver "Stoneblock 4" +``` + --- ## Future Enhancements -1. **Delete command:** `!deleteserver "Stoneblock 4"` — removes category and all channels when server retired *(confirmed needed)* -2. **Discord-Minecraft integration:** `in-game-chat` channel planned to connect to Minecraft via a mod (e.g., Discord Integration, dclink, or similar Forge/NeoForge mod) -3. **Permission templates:** Auto-apply role permissions (subscribers only, etc.) -4. **Trinity Console integration:** Button in admin panel instead of bot command +1. **Discord-Minecraft integration:** `in-game-chat` channel planned to connect to Minecraft via a mod (e.g., Discord Integration, dclink, or similar Forge/NeoForge mod) +2. **Permission templates:** Auto-apply role permissions (subscribers only, etc.) +3. **Trinity Console integration:** Button in admin panel instead of bot command +4. **Carl-bot API integration:** Auto-configure reaction role mapping (if API available) --- ## Acceptance Criteria -- [ ] Holly can type `!createserver "Server Name"` in Discord +- [ ] Holly can type `!createserver "Server Name" 🎮` in Discord +- [ ] Bot creates server role with matching name - [ ] Bot creates category + 4 channels with correct types - [ ] Channels appear under the Servers category +- [ ] Bot adds emoji reaction to role selection message - [ ] Permissions match existing manual setup -- [ ] `!deleteserver "Server Name"` removes all channels (stretch goal) +- [ ] `!deleteserver "Server Name"` removes role + all channels --- ## Notes - All 4 channels have the same permissions (confirmed by Michael) -- Delete command confirmed needed for server retirement +- Delete command removes both role AND channels for server retirement - `in-game-chat` Discord-Minecraft integration is planned (needs Forge/NeoForge mod, not plugin) +- Carl-bot reaction role mapping may still require manual step in dashboard unless API is available +- Role selection message location: TBD (needs channel ID and message ID configured) - This is a quality-of-life improvement for Holly, not a launch blocker ---