mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-23 21:52:45 -05:00
- 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
39 lines
1.3 KiB
JavaScript
39 lines
1.3 KiB
JavaScript
import { CommandBuilder } from "../src/CommandHandler.mjs";
|
|
import { EmbedBuilder } from "@fluxerjs/core";
|
|
import { getGlobalColor } from "../src/MessageHandler.mjs";
|
|
|
|
export const command = new CommandBuilder()
|
|
.setName("debug")
|
|
.setDescription("A debug command for various purposes.")
|
|
.setRequirement(r => r.setOwnerOnly(true))
|
|
.setCategory("util")
|
|
.addChoiceOption(o =>
|
|
o.setName("target")
|
|
.setDescription("The target that should be examined.")
|
|
.addChoices("voice")
|
|
.setRequired(true));
|
|
|
|
export function run(msg, data) {
|
|
switch (data.get("target").value) {
|
|
case "voice": {
|
|
const servers = [...this.players.playerMap.entries()].map(([cid, s]) => {
|
|
const channel = this.client.channels.get(cid);
|
|
return {
|
|
name: channel?.name ?? "unknown",
|
|
id: channel?.id ?? cid,
|
|
status: s.connection?.state?.status ?? "unknown",
|
|
guildname: channel?.guild?.name ?? "unknown",
|
|
guildid: channel?.guildId ?? "unknown"
|
|
};
|
|
});
|
|
const embed = new EmbedBuilder()
|
|
.setColor(getGlobalColor())
|
|
.setTitle(this.t(msg, "responses.debug.voiceTitle"))
|
|
.setDescription("```json\n" + JSON.stringify(servers, null, 2) + "\n```")
|
|
;
|
|
msg.reply({ embeds: [embed] });
|
|
break;
|
|
}
|
|
}
|
|
}
|