Files
fluxer/commands/logtest.mjs
T
NoLogicAlan 3b9620012f feat: modernize UI, overhaul ErrorChannel telemetry, and achieve 100% 6-locale parity
- Core & Telemetry:
  * Overhaul ErrorChannel (config.errorLogChannel) to rich Pro Embeds with severity color coding (Error, Warn, Info).
  * Add structured crash reports featuring syntax-highlighted stack traces, uptime, and RSS memory telemetry.
  * Add log flood drop notifications and startup connection status announcement.
  * Support dynamic self-hosted Fluxer API base resolution (config.apiBase / config['fluxer.js'].api).
  * Wire ErrorChannel into the localization system with dynamic _t() translation and safe fallback.

- Localization & i18n:
  * Expand all 6 locale files (en, ar-SA, ckb, tr, de-DE, pt-BR) to 1,112 keys each.
  * Achieve 100% key parity and 0 variable mismatches across all supported languages.
  * Localize all embed titles, author badges, footers, and system responses.

- Commands & Modern UI:
  * Upgrade all commands (playback, queue, audio DSP, utility, lastfm, settings, owner) to the modern Pro UI embed design.
  * Add previous, replay, and skipto queue navigation commands with history tracking.
  * Replace raw unicode escapes with literal UTF-8 emojis.
  * Maintain clean codebase standards (zero single-line comments introduced, commands/stats.mjs strictly untouched).

- Architecture & Voice:
  * Enhance FluxerAudioBridge, VoiceStateRouting, and VoiceStateCache for reliable voice reconnects.
  * Refactor centralized database pooling and player lifecycle mixins.
2026-10-28 02:19:26 +03:00

59 lines
2.4 KiB
JavaScript

/**
* @module commands/logtest
* @description Owner-only diagnostic command that posts a test entry into the
* configured error-log channel (see config.errorLogChannel), so the owner can
* verify the ErrorChannel wiring end to end: tap -> queue -> REST delivery.
*/
import { CommandBuilder } from "../src/commands/index.mjs";
import { EmbedBuilder } from "@fluxerjs/core";
import { getGlobalColor } from "../src/ui/index.mjs";
import { logger } from "../src/core/Logger.mjs";
import { isLogChannelEnabled } from "../src/core/ErrorChannel.mjs";
/** @type {CommandBuilder} @description Command definition for the logtest command (owner-only). */
export const command = new CommandBuilder()
.setName("logtest")
.setDescription("Sends a test entry to your error-log channel.")
.setCategory("util")
.setRequirement(r => r.setOwnerOnly(true));
/**
* @async
* Run handler for the logtest command. Reports the ErrorChannel status and,
* when enabled, pushes one deliberately distinctive test line through
* logger.error so it travels the exact same path a real error would.
* @param {object} msg - The command message wrapper.
* @returns {Promise<void>}
*/
export async function run(msg) {
if (!isLogChannelEnabled()) {
const embed = new EmbedBuilder()
.setColor(getGlobalColor())
.setAuthor({ name: this.t(msg, "responses.logtest.author") })
.setTitle(this.t(msg, "responses.logtest.disabledTitle"))
.setDescription(
"❌ The error-log channel is **disabled**.\n" +
"Set `errorLogChannel.enabled` to `true` and `errorLogChannel.channelId` to your log channel ID in config.json, then restart the bot."
)
.setFooter({ text: this.t(msg, "responses.logtest.footerConfig") });
return msg.reply({ embeds: [embed] });
}
const who = msg.author?.username ?? msg.message?.author?.username ?? "owner";
logger.error(
"[LogTest]",
`Manual test entry requested by ${who} — if you can read this in the log channel, error forwarding is working.`
);
const embed = new EmbedBuilder()
.setColor(getGlobalColor())
.setAuthor({ name: this.t(msg, "responses.logtest.author") })
.setTitle(this.t(msg, "responses.logtest.queuedTitle"))
.setDescription(
"📨 Test entry queued — check the log channel; it should arrive within a few seconds."
)
.setFooter({ text: this.t(msg, "responses.logtest.footerPipeline") });
return msg.reply({ embeds: [embed] }).catch(() => {});
}