mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
feat: add i18n locale system and fix pagination/help bugs
- Add Locale class (src/constants/Locale.mjs) with per-guild translation
support and settings-manager binding
- Wire locale into CommandHandler, MessageHandler, Player, PlayerManager,
and index.mjs via setLocale() / t() helpers
- Replace all hardcoded English strings (help pages, errors, now-playing,
permission messages, session-closed footers) with locale key lookups
- Fix: %help triggering "Unknown command" — replyHandler intercept now
uses case-insensitive check for "unknown command"
- Fix: TypeError crash in closeSession when embed has no footer — guard
with `if (!footer) footer = { text: "" }` before appending
- Fix: media player teardown now calls destroy() and nulls the instance
instead of relying on _stopMediaPlayer(), preventing stale state
- Refactor: reply() and send() auto-wrap plain strings in embeds,
matching old replyEmbed/sendEmbed behaviour
- Refactor: permission errors and invalid-flag errors use t() lookups
- Add top-level t(message, key, data) helper on the bot instance for
command files to resolve guild locale without manual guildId plumbing
This commit is contained in:
1 parent
1ff1f9d78f
commit
6060e6d318
36 files changed
+2752
-689
No files matched your search
@@ -38,25 +38,26 @@ export async function run(message, data) {
|
||||
if (!volOption || raw === null || raw === undefined || isNaN(Number(raw))) {
|
||||
const currentDefault = set?.get("volume") ?? 100;
|
||||
const currentPlayerVol = Math.round((p.preferredVolume ?? 1) * 100);
|
||||
const pfx = set?.get("prefix") ?? "%";
|
||||
embed
|
||||
.setTitle("🔊 Volume Settings")
|
||||
.setTitle(this.t(message, "responses.volumedefault.title"))
|
||||
.setDescription(
|
||||
`• Server default: \`${currentDefault}%\`\n` +
|
||||
`• Current player volume: \`${currentPlayerVol}%\`\n\n` +
|
||||
this.t(message, "responses.volumedefault.serverDefault", { volume: currentDefault }) + "\n" +
|
||||
this.t(message, "responses.volumedefault.currentVolume", { volume: currentPlayerVol }) + "\n\n" +
|
||||
(hasManage
|
||||
? `To change the default, use: \`${set?.get("prefix") ?? "%"}volumedefault <0-${MAX_VOLUME}>\``
|
||||
: `⚠️ You need **Manage Server** permission to change the default.`)
|
||||
? this.t(message, "responses.volumedefault.changeHint", { prefix: pfx, max: MAX_VOLUME })
|
||||
: this.t(message, "responses.volumedefault.noPermission"))
|
||||
);
|
||||
} else if (!hasManage) {
|
||||
embed.setDescription("❌ You need **Manage Server** permission to set the server default volume.");
|
||||
embed.setDescription(this.t(message, "responses.volumedefault.noPermissionSet"));
|
||||
} else {
|
||||
const pct = Number(raw);
|
||||
if (pct < 0 || pct > MAX_VOLUME) {
|
||||
embed.setDescription(`❌ Volume must be between \`0\` and \`${MAX_VOLUME}%\`.`);
|
||||
embed.setDescription(this.t(message, "responses.volumedefault.outOfRange", { max: MAX_VOLUME }));
|
||||
} else {
|
||||
p.setVolume(pct / 100);
|
||||
if (set) set.set("volume", pct);
|
||||
embed.setDescription(`🔊 Server default volume saved as \`${pct}%\`.`);
|
||||
embed.setDescription(this.t(message, "responses.volumedefault.saved", { volume: pct }));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user