This commit is contained in:
NoLogicAlan committed 2026-09-25 01:27:53 +03:00
1 parent 1f11239376
commit 923f9f2ce3
5 files changed
+17 -11

No files matched your search

+1 -1
View File
@@ -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) {
+7 -2
View File
@@ -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 ?? "%";
}