mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
- Redesign %np, Added-to-Queue, and Auto-Announcement embeds with rich 3-column layouts - Standardize all embeds to brand color #e9196c - Transform Queue-Ended announcement with quick-action suggestions (%radio, %autoplay) - Unify message forwarder in commands/play to support rich EmbedBuilder payloads - Add native localization keys across all 6 supported locales (en, ar-SA, tr, de-DE, pt-BR, ckb)
50 lines
1.7 KiB
JavaScript
50 lines
1.7 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())
|
|
.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()).setDescription(this.t(msg, "responses._common.nothingPlaying"))] }).catch(() => {});
|
|
return;
|
|
}
|
|
const embed = data.embed || new EmbedBuilder()
|
|
.setColor(getGlobalColor())
|
|
.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()).setDescription(this.t(msg, "responses._common.nothingPlaying"))] }).catch(() => {});
|
|
}
|
|
}
|