diff --git a/src/GatewayHandler.mjs b/src/GatewayHandler.mjs index ab27d38..a9a7a08 100644 --- a/src/GatewayHandler.mjs +++ b/src/GatewayHandler.mjs @@ -1396,12 +1396,12 @@ export class GatewayHandler { const set = remix.settingsMgr.getServer(guildId); if (set) { const raw = set.get("stay_247"); + const arr = Array.isArray(raw) ? raw : raw ? [raw] : []; const channels = new Set( - (Array.isArray(raw) ? raw : raw ? [raw] : []) - .filter(id => id && id !== "none" && String(id).replace(/\D/g, "") !== channelId) + arr.filter(id => id && id !== "none" && String(id).replace(/\D/g, "") !== channelId) ); - remove247ChannelMode(set, channelId, channels); set.set("stay_247", channels.size > 0 ? [...channels] : "none"); + remove247ChannelMode(set, channelId, channels); } } catch (cleanupErr) { logger.warn(`[BootRecovery] Failed to auto-remove missing channel ${channelId} from 24/7:`, cleanupErr?.message); diff --git a/src/constants/Locale.mjs b/src/constants/Locale.mjs index e936e4b..f9e06e4 100644 --- a/src/constants/Locale.mjs +++ b/src/constants/Locale.mjs @@ -160,8 +160,9 @@ export class Locale { if (typeof value !== "string") return key; for (const [placeholder, val] of Object.entries(replacements)) { + const escaped = placeholder.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); value = value.replace( - new RegExp(`\\{\\{${placeholder}\\}\\}`, "g"), + new RegExp(`\\{\\{${escaped}\\}\\}`, "g"), String(val ?? "") ); } diff --git a/storage/locales/bot/ar-SA.json b/storage/locales/bot/ar-SA.json index f1d3ca1..e66ae2a 100644 --- a/storage/locales/bot/ar-SA.json +++ b/storage/locales/bot/ar-SA.json @@ -5,6 +5,11 @@ }, "subcommand": { "invalid": "أمر فرعي غير صالح. جرّب أحد الخيارات التالية: `$previousCmd <$cmdlist>`" + }, + "option": { + "invalidChoice": "قيمة غير صالحة '{{$currValue}}'. يجب أن يكون الخيار `{{$optionName}}` أحد الخيارات التالية:\n{{$choices}}\nالشكل: `$previousCmd <{{$type}}>`", + "invalidChannel": "قيمة غير صالحة '{{$currValue}}'. يجب أن يكون الخيار `{{$optionName}}` إشارة قناة أو معرف أو اسم.\nالشكل: `$previousCmd <{{$type}}>`", + "invalidType": "قيمة غير صالحة '{{$currValue}}'. يجب أن يكون الخيار `{{$optionName}}` من النوع `{{$type}}`.\nالشكل: `$previousCmd <{{$type}}>`" } }, "cmdHandler": { diff --git a/storage/locales/bot/ckb.json b/storage/locales/bot/ckb.json index 27bb395..71c30b7 100644 --- a/storage/locales/bot/ckb.json +++ b/storage/locales/bot/ckb.json @@ -5,6 +5,11 @@ }, "subcommand": { "invalid": "فەرمانی لاوەکی نادروست. یەکێک لەم هەڵبژاردانەی خوارەوە تاقی بکەرەوە: `$previousCmd <$cmdlist>`" + }, + "option": { + "invalidChoice": "بەهای نادروست '{{$currValue}}'. هەڵبژاردەی `{{$optionName}}` دەبێت یەکێک بێت لەمانەی خوارەوە:\n{{$choices}}\nشێواز: `$previousCmd <{{$type}}>`", + "invalidChannel": "بەهای نادروست '{{$currValue}}'. هەڵبژاردەی `{{$optionName}}` دەبێت باسی کەناڵ، ID، یان ناو بێت.\nشێواز: `$previousCmd <{{$type}}>`", + "invalidType": "بەهای نادروست '{{$currValue}}'. هەڵبژاردەی `{{$optionName}}` دەبێت جۆری `{{$type}}` بێت.\nشێواز: `$previousCmd <{{$type}}>`" } }, "cmdHandler": { diff --git a/storage/locales/bot/de-DE.json b/storage/locales/bot/de-DE.json index 2f07640..4dfa4b6 100644 --- a/storage/locales/bot/de-DE.json +++ b/storage/locales/bot/de-DE.json @@ -5,6 +5,11 @@ }, "subcommand": { "invalid": "Ungültiger Unterbefehl. Versuche eine der folgenden Optionen: `$previousCmd <$cmdlist>`" + }, + "option": { + "invalidChoice": "Ungültiger Wert '{{$currValue}}'. Die Option `{{$optionName}}` muss eine der folgenden sein:\n{{$choices}}\nSchema: `$previousCmd <{{$type}}>`", + "invalidChannel": "Ungültiger Wert '{{$currValue}}'. Die Option `{{$optionName}}` muss eine Kanalerwähnung, ID oder Name sein.\nSchema: `$previousCmd <{{$type}}>`", + "invalidType": "Ungültiger Wert '{{$currValue}}'. Die Option `{{$optionName}}` muss vom Typ `{{$type}}` sein.\nSchema: `$previousCmd <{{$type}}>`" } }, "cmdHandler": { diff --git a/storage/locales/bot/pt-BR.json b/storage/locales/bot/pt-BR.json index af11411..571cf8f 100644 --- a/storage/locales/bot/pt-BR.json +++ b/storage/locales/bot/pt-BR.json @@ -5,6 +5,11 @@ }, "subcommand": { "invalid": "Subcomando inválido. Tente uma das seguintes opções: `$previousCmd <$cmdlist>`" + }, + "option": { + "invalidChoice": "Valor inválido '{{$currValue}}'. A opção `{{$optionName}}` deve ser uma das seguintes:\n{{$choices}}\nEsquema: `$previousCmd <{{$type}}>`", + "invalidChannel": "Valor inválido '{{$currValue}}'. A opção `{{$optionName}}` deve ser uma menção de canal, ID ou nome.\nEsquema: `$previousCmd <{{$type}}>`", + "invalidType": "Valor inválido '{{$currValue}}'. A opção `{{$optionName}}` deve ser do tipo `{{$type}}`.\nEsquema: `$previousCmd <{{$type}}>`" } }, "cmdHandler": {