Files
fluxer/commands/np.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

51 lines
2.0 KiB
JavaScript

/**
* @module commands/np
* @description Display the currently playing track name and URL.
*/
import { CommandBuilder } from "../src/commands/index.mjs";
import { EmbedBuilder } from "@fluxerjs/core";
import { getGlobalColor } from "../src/ui/index.mjs";
/** @type {CommandBuilder} @description Command definition for the np (now playing) command. */
export const command = new CommandBuilder()
.setName("np")
.setDescription("Request the name and url of the currently playing song.", "commands.np")
.addAliases("current", "nowplaying")
.setCategory("music");
/**
* @async
* Run handler for the np command.
* Fetches and displays the now-playing status with track title and thumbnail.
* @param {object} msg - The command message wrapper.
* @returns {Promise<void>}
*/
export async function run(msg) {
const p = await this.getPlayer(msg);
if (!p) return;
const loadingEmbed = new EmbedBuilder()
.setColor(getGlobalColor())
.setAuthor({ name: this.t(msg, "responses.np.nowPlayingAuthor") })
.setDescription(this.t(msg, "responses.np.loading"));
const loadingMsg = await msg.reply({ embeds: [loadingEmbed] });
try {
const data = await p.nowPlaying();
if (!data?.msg && !data?.embed) {
loadingMsg.edit({ embeds: [new EmbedBuilder().setColor(getGlobalColor()).setAuthor({ name: this.t(msg, "responses.np.nowPlayingAuthor") }).setDescription(this.t(msg, "responses._common.nothingPlaying"))] }).catch(() => {});
return;
}
const embed = data.embed || new EmbedBuilder()
.setColor(getGlobalColor())
.setAuthor({ name: this.t(msg, "responses.np.nowPlayingAuthor") })
.setDescription(data.msg);
if (!data.embed && data.image) embed.setThumbnail(data.image);
loadingMsg.edit({ embeds: [embed] }).catch(() => {});
} catch (e) {
loadingMsg.edit({ embeds: [new EmbedBuilder().setColor(getGlobalColor()).setAuthor({ name: this.t(msg, "responses.np.nowPlayingAuthor") }).setDescription(this.t(msg, "responses._common.nothingPlaying"))] }).catch(() => {});
}
}