mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-23 21:52:45 -05:00
chore: bump @fluxerjs/core + voice to v1.4.0, add allowedMentions suppression
- 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(...)
This commit is contained in:
1 parent
20813bd1ff
commit
49447dc37b
5 files changed
+23
-12
No files matched your search
@@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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`);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user