From 49447dc37b59a646ea31a14cdfb4dfb28f529569 Mon Sep 17 00:00:00 2001 From: NoLogicAlan Date: Sat, 20 Jun 2026 22:49:56 +0300 Subject: [PATCH] chore: bump @fluxerjs/core + voice to v1.4.0, add allowedMentions suppression MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Bump SDK deps to ^1.4.0 (ws security fix, official { ping: false } support, allowedMentions on channel.send) - Add allowedMentions: { parse: [] } to announcement channel.send() calls in PlayerManager, index._spawnPlayer, and GatewayHandler permission warnings — prevents accidental pings from embed descriptions containing user mentions - Fix unhandled rejection in CommandLoader error-reply: the fallback data.message.reply() wasn't caught, so a network failure during the error-reply itself would crash. Now wrapped in Promise.resolve(...).catch(...) --- index.mjs | 5 ++++- package.json | 4 ++-- src/CommandHandler.mjs | 8 ++++++-- src/GatewayHandler.mjs | 11 ++++++----- src/PlayerManager.mjs | 7 +++++-- 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/index.mjs b/index.mjs index c50fb44..cefebc7 100644 --- a/index.mjs +++ b/index.mjs @@ -784,7 +784,10 @@ export class Remix { if (!player.textChannel) player.textChannel = ch; - ch.send(typeof m === "object" && Array.isArray(m.embeds) ? m : { embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(m)] }).catch(err => { + const payload = typeof m === "object" && Array.isArray(m.embeds) + ? { ...m, allowedMentions: { parse: [] } } + : { embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(m)], allowedMentions: { parse: [] } }; + ch.send(payload).catch(err => { if (err.code === 'MISSING_PERMISSIONS' || err.statusCode === 403) { logger.warn(`[_spawnPlayer] Cannot send announcement in channel ${ch.id} — missing permissions`); } diff --git a/package.json b/package.json index ed7d968..28eda94 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "node": ">=22.0.0" }, "dependencies": { - "@fluxerjs/core": "^1.3.1", - "@fluxerjs/voice": "^1.3.1", + "@fluxerjs/core": "^1.4.0", + "@fluxerjs/voice": "^1.4.0", "bcryptjs": "^3.0.3", "ffmpeg-static": "^5.3.0", "ffprobe-static": "^3.1.0", diff --git a/src/CommandHandler.mjs b/src/CommandHandler.mjs index 33c8d88..c39c0c9 100644 --- a/src/CommandHandler.mjs +++ b/src/CommandHandler.mjs @@ -822,19 +822,23 @@ export class CommandLoader { this.commands.on("run", (data) => { if (!this.runnables.has(data.command.uid)) return; const runFc = this.runnables.get(data.command.uid); + const sendErrorReply = (id) => { + Promise.resolve(data.message.reply("An error occurred. Error id: `#" + id + "`")) + .catch(err => logger.warn("[CommandHandler] Failed to send error-reply; error id #" + id + ":", err?.message)); + }; try { const result = runFc.call(this.context, data.message, data); if (result && typeof result.catch === "function") { result.catch(e => { const id = Utils.uid(); logger.error("Error running command; error id #" + id, e); - data.message.reply("An error occurred. Error id: `#" + id + "`"); + sendErrorReply(id); }); } } catch (e) { const id = Utils.uid(); logger.error("Error running command; error id #" + id, e); - data.message.reply("An error occurred. Error id: `#" + id + "`"); + sendErrorReply(id); } }); } diff --git a/src/GatewayHandler.mjs b/src/GatewayHandler.mjs index 623d87a..837ef4b 100644 --- a/src/GatewayHandler.mjs +++ b/src/GatewayHandler.mjs @@ -138,16 +138,17 @@ export class GatewayHandler { try { const permEmbed = remix.messages.buildPermissionEmbed(result.missing, guildId); - await targetChannel.send({ embeds: [permEmbed] }); + await targetChannel.send({ embeds: [permEmbed], allowedMentions: { parse: [] } }); } catch (e) { logger.warn(`[GuildCreate] Cannot send permission warning to server ${guildId}: ${e.message}`); try { const t = this.remix.locale?.translate?.bind(this.remix.locale); const guildIdStr = cleanId(guildId); - await targetChannel.send( - t ? t(guildIdStr, "responses.gateway.missingPermsFallback", { perms: missingNames.join("**, **") }) : - "⚠️ I'm missing permissions I need to work properly! Missing: **" + missingNames.join("**, **") + "**. Please ask a server administrator to grant these permissions in Server Settings → Roles." - ); + await targetChannel.send({ + content: t ? t(guildIdStr, "responses.gateway.missingPermsFallback", { perms: missingNames.join("**, **") }) : + "⚠️ I'm missing permissions I need to work properly! Missing: **" + missingNames.join("**, **") + "**. Please ask a server administrator to grant these permissions in Server Settings → Roles.", + allowedMentions: { parse: [] }, + }); } catch (e) { logger.warn(`[GuildCreate] Cannot send ANY notification to server ${guildId} — bot is missing SendMessages permission:`, e?.message); } diff --git a/src/PlayerManager.mjs b/src/PlayerManager.mjs index 9722ccc..cfa0da9 100644 --- a/src/PlayerManager.mjs +++ b/src/PlayerManager.mjs @@ -853,7 +853,7 @@ export class PlayerManager { ?? `Left channel <#${activeChannelId}> because of inactivity.\nIf you want me to stay in voice, use \`${prefix}247 on/auto\``; } if (typeof ch?.send === "function") { - ch.send({ embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc)] }).catch(err => { + ch.send({ embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc)], allowedMentions: { parse: [] } }).catch(err => { if (err.code === 'MISSING_PERMISSIONS' || err.statusCode === 403) { logger.warn(`[PlayerManager] Cannot send autoleave message in channel ${ch.id} — missing permissions`); } @@ -910,7 +910,10 @@ export class PlayerManager { if (!player.textChannel) player.textChannel = ch; - ch.send(typeof m === "object" && Array.isArray(m.embeds) ? m : { embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(m)] }).catch(err => { + const payload = typeof m === "object" && Array.isArray(m.embeds) + ? { ...m, allowedMentions: { parse: [] } } + : { embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(m)], allowedMentions: { parse: [] } }; + ch.send(payload).catch(err => { if (err.code === 'MISSING_PERMISSIONS' || err.statusCode === 403) { logger.warn(`[PlayerManager] Cannot send player message in channel ${ch.id} — missing permissions`); }