refactor: centralize prefix resolution into CommandHandler

Replace all scattered prefix lookups across the codebase with a single
source of truth: CommandHandler.getPrefix(guildId).
This commit is contained in:
NoLogicAlan committed 2026-05-31 15:02:18 +03:00
1 parent 23d0dbc522
commit ba479e4c04
25 files changed
+155 -159

No files matched your search

+3 -1
View File
@@ -161,6 +161,7 @@ export class Remix {
commands.setPrefixManager(prefixMgr);
commands.setLocale(this.locale);
messages.setLocale(this.locale);
this.locale.setPrefixResolver((guildId) => commands.getPrefix(guildId));
new HelpCommand(commands, messages, (msg) => this.getSettings(msg)).register();
@@ -687,6 +688,7 @@ export class Remix {
moonlink: this.moonlink ?? null,
revoice: this.revoice ?? null,
settingsMgr: this.settingsMgr ?? this.settings ?? null,
getPrefix: (guildId) => this.handler.getPrefix(guildId),
observedVoiceUsers: this.observedVoiceUsers ?? null,
voiceCache: this.voiceCache ?? null,
locale: this.locale ?? null,
@@ -819,7 +821,7 @@ export class Remix {
if (channels.has(cleanId) && !force) {
if (channelMode === "auto") {
if (message) {
const prefix = (() => { try { return set.get("prefix") ?? "%"; } catch (_) { return "%"; } })();
const prefix = this.handler.getPrefix(cleanGuildId);
const guildIdForLocale = message?.channel?.channel?.guildId ?? message?.guildId ?? cleanGuildId;
message.replyEmbed(
this.locale.translate(guildIdForLocale, "responses.leave.autoRejoinHint", {