From e53f6675ea3f36ad9794c1d5ef0df7082cb77db6 Mon Sep 17 00:00:00 2001 From: Spicy_Marinara Date: Tue, 14 Oct 2025 12:17:57 +0200 Subject: [PATCH] fix: Use more compatible emoji parsing without Unicode property escapes - Replaced \p{Emoji} regex with line-by-line parsing - Avoids compatibility issues with older JavaScript engines - Skips percentage and inventory lines to find mood emoji - Supports all emoji types including compound emojis --- index.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 66a7db3..338edfb 100644 --- a/index.js +++ b/index.js @@ -1510,9 +1510,21 @@ function parseUserStats(statsText) { const arousalMatch = statsText.match(/Arousal:\s*(\d+)%/); // Match new format: [Emoji]: [Conditions] - // Look for emoji (including compound emojis with ZWJ) followed by colon, then conditions - // Using [\p{Emoji}\u200D]+ to capture compound emojis with zero-width joiners - const moodMatch = statsText.match(/([\p{Emoji}\uFE0F\u200D]+):\s*(.+)/u); + // Look for a line after Arousal that has format [something]: [text] + // Split by lines and find the line after percentages + const lines = statsText.split('\n'); + let moodMatch = null; + for (let i = 0; i < lines.length; i++) { + const line = lines[i].trim(); + // Skip lines with percentages or "Inventory:" + if (line.includes('%') || line.toLowerCase().startsWith('inventory:')) continue; + // Match emoji followed by colon and conditions + const match = line.match(/^(.+?):\s*(.+)$/); + if (match) { + moodMatch = match; + break; + } + } // Extract inventory const inventoryMatch = statsText.match(/Inventory:\s*(.+)/i);