mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
hotfix
This commit is contained in:
1 parent
1f11239376
commit
923f9f2ce3
5 files changed
+17
-11
No files matched your search
@@ -448,10 +448,10 @@ export class CommandHandler extends EventEmitter {
|
||||
const authorId = msg.message?.author?.id;
|
||||
const isOwner = this.owners.includes(authorId);
|
||||
const permGuildId = msg.channel?.channel?.guildId ?? msg.message?.guildId;
|
||||
if (!isOwner && cmd.requirements.some(r => r.ownerOnly)) return false;
|
||||
|
||||
for (let i = 0; i < cmd.requirements.length; i++) {
|
||||
let req = cmd.requirements[i];
|
||||
if (req.ownerOnly && !isOwner) return false;
|
||||
if (req.permissions.length > 0 && !isOwner) {
|
||||
const guild = msg.message?.guild ?? null;
|
||||
if (!guild) {
|
||||
|
||||
@@ -24,11 +24,16 @@ export class PrefixManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the command prefix for a guild.
|
||||
* @param {string} guildId
|
||||
* Get the command prefix for a guild. DMs and any other context without a
|
||||
* real guildId skip the settings lookup entirely — falling through to
|
||||
* getServer(undefined) would create and permanently cache a phantom
|
||||
* "undefined" guild entry in the settings store, which then shows up in
|
||||
* every guilds-map iteration (24/7 watchdog, shutdown save-all, etc.).
|
||||
* @param {string|null|undefined} guildId
|
||||
* @returns {string}
|
||||
*/
|
||||
getPrefix(guildId) {
|
||||
if (!guildId) return this.configPrefix ?? "%";
|
||||
const serverPrefix = this.settings.getServer(guildId).get("prefix");
|
||||
return serverPrefix ?? this.configPrefix ?? "%";
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* used by every command.
|
||||
*/
|
||||
|
||||
import { Client, Events, EmbedBuilder, PermissionFlags } from "@fluxerjs/core";
|
||||
import { Client, Events, EmbedBuilder, PermissionFlags, ErrorCodes } from "@fluxerjs/core";
|
||||
import { logger } from "../core/Logger.mjs";
|
||||
import { Utils } from "../utils/Utils.mjs";
|
||||
import { Message, Channel } from "./Wrappers.mjs";
|
||||
@@ -498,7 +498,7 @@ export class MessageHandler {
|
||||
try {
|
||||
return new Message(await message.edit(payload), this);
|
||||
} catch (err) {
|
||||
if (err.code === "UNKNOWN_MESSAGE" || err.code === 10008) {
|
||||
if (err.code === ErrorCodes.MessageNotFound || String(err?.message ?? "").includes("Message wasn't found")) {
|
||||
logger.warn("[MessageHandler] editEmbed: Message no longer exists, skipping edit.");
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* (two-arrow embed paging).
|
||||
*/
|
||||
|
||||
import { EmbedBuilder } from "@fluxerjs/core";
|
||||
import { EmbedBuilder, ErrorCodes } from "@fluxerjs/core";
|
||||
import { logger } from "../core/Logger.mjs";
|
||||
import { Message } from "./Wrappers.mjs";
|
||||
import { getGlobalColor } from "./Embeds.mjs";
|
||||
@@ -248,14 +248,14 @@ export class RichPaginator {
|
||||
await rawMsg.removeAllReactions();
|
||||
return;
|
||||
} catch (e) {
|
||||
if (String(e?.message ?? e).includes("Message wasn't found") || e?.code === 10008) return;
|
||||
if (String(e?.message ?? e).includes("Message wasn't found") || e?.code === ErrorCodes.MessageNotFound) return;
|
||||
logger.warn("[RichPaginator] removeAllReactions failed:", e?.message ?? e);
|
||||
}
|
||||
for (const emoji of allReactions) {
|
||||
try {
|
||||
await rawMsg.removeReaction(emoji);
|
||||
} catch(e) {
|
||||
if (String(e?.message ?? e).includes("Message wasn't found") || e?.code === 10008) return;
|
||||
if (String(e?.message ?? e).includes("Message wasn't found") || e?.code === ErrorCodes.MessageNotFound) return;
|
||||
logger.warn("[MessageHandler] Error:", e?.message);
|
||||
}
|
||||
}
|
||||
@@ -346,12 +346,12 @@ export class QueuePaginator {
|
||||
try {
|
||||
await rawMsg.removeAllReactions();
|
||||
} catch (e) {
|
||||
if (String(e?.message ?? e).includes("Message wasn't found") || e?.code === 10008) return;
|
||||
if (String(e?.message ?? e).includes("Message wasn't found") || e?.code === ErrorCodes.MessageNotFound) return;
|
||||
for (const emoji of [prev, next]) {
|
||||
try {
|
||||
await rawMsg.removeReaction(emoji);
|
||||
} catch(e) {
|
||||
if (String(e?.message ?? e).includes("Message wasn't found") || e?.code === 10008) return;
|
||||
if (String(e?.message ?? e).includes("Message wasn't found") || e?.code === ErrorCodes.MessageNotFound) return;
|
||||
logger.warn("[MessageHandler] Error:", e?.message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
import { logger } from "../../core/Logger.mjs";
|
||||
import { cleanId } from "../../utils/Utils.mjs";
|
||||
import { get247ChannelMode, isPlayerConnectionDead, detachPlayerFromManager } from "../../utils/Helpers247.mjs";
|
||||
import { ErrorCodes } from "@fluxerjs/core";
|
||||
|
||||
/** @type {number} Default sweep interval (ms). Overridable via config.timers.watchdog247Interval. */
|
||||
const DEFAULT_SWEEP_INTERVAL = 60_000;
|
||||
@@ -99,7 +100,7 @@ const Watchdog247 = {
|
||||
if (fetched) return { channel: fetched, definitive: false };
|
||||
return { channel: null, definitive: true };
|
||||
} catch (err) {
|
||||
const gone = err?.code === "CHANNEL_NOT_FOUND"
|
||||
const gone = err?.code === ErrorCodes.ChannelNotFound
|
||||
|| err?.statusCode === 404 || err?.status === 404
|
||||
|| /\b404\b|not found|unknown channel/i.test(String(err?.message ?? ""));
|
||||
return { channel: null, definitive: gone };
|
||||
|
||||
Reference in new issue
Block a user