From 47a600eeb529e9e3774084e39607ab39d1e0bd6c Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 9 Apr 2026 20:03:41 +0000 Subject: [PATCH] Fix: Handle server names with subtitles for Discord channel matching - 'Homestead - A Cozy Survival Experience' now matches 'homestead-chat' - 'All The Mons (Private) - TX' now matches 'all-the-mons-chat' - Strips subtitles after ' - ' and removes parentheticals --- .../arbiter-3.0/src/routes/admin/servers.js | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/services/arbiter-3.0/src/routes/admin/servers.js b/services/arbiter-3.0/src/routes/admin/servers.js index d28a2c6..2baece1 100644 --- a/services/arbiter-3.0/src/routes/admin/servers.js +++ b/services/arbiter-3.0/src/routes/admin/servers.js @@ -42,19 +42,30 @@ async function getDiscordChannels(client) { * Returns object with missing channels array */ function checkServerChannels(serverName, allChannels) { - // Normalize server name to expected channel format - const baseName = serverName + // Extract the base name (before any " - " subtitle or parenthetical) + // "Homestead - A Cozy Survival Experience" -> "homestead" + // "All The Mons (Private) - TX" -> "all-the-mons" + // "Stoneblock 4" -> "stoneblock-4" + let baseName = serverName + .split(' - ')[0] // Take part before " - " subtitle + .replace(/\s*\([^)]*\)\s*/g, '') // Remove parentheticals like (Private) .toLowerCase() - .replace(/[^a-z0-9\s-]/g, '') // Remove special chars except spaces/hyphens - .replace(/\s+/g, '-') // Spaces to hyphens - .replace(/-+/g, '-') // Multiple hyphens to single + .replace(/[^a-z0-9\s]/g, '') // Remove special chars except spaces + .replace(/\s+/g, '-') // Spaces to hyphens + .replace(/-+/g, '-') // Multiple hyphens to single + .trim(); + + // Also create a display name for voice channel matching + const voiceDisplayName = serverName + .split(' - ')[0] + .replace(/\s*\([^)]*\)\s*/g, '') .trim(); const expectedChannels = [ { name: `${baseName}-chat`, type: 'text', label: 'Chat' }, { name: `${baseName}-in-game`, type: 'text', label: 'In-Game' }, { name: `${baseName}-forum`, type: 'forum', label: 'Forum' }, - { name: serverName, type: 'voice', label: 'Voice' } // Voice uses display name + { name: voiceDisplayName, type: 'voice', label: 'Voice' } ]; const missing = [];