Files
fluxer/commands/thumbnail.mjs
T
NoLogicAlan 4c3c04bd7d feat(ui): upgrade audio DSP, seek, thumbnail, and voice session embeds
- Modernize %seek with track artwork thumbnail and visual progress bar
- Enhance %filter with real-time DSP active status badges and card spacing
- Add detailed frequency band indicators to %bassboost, %speed, and %pitch
- Redesign %thumbnail with framed artwork and song metadata
- Transform %leave into a structured voice session termination card
- Polish %ping with categorized latency health metrics (REST, Gateway, Audio Node)
- Leave %stats untouched as intended
- Complete translations across all 6 locales (en, ar-SA, ckb, tr, de-DE, pt-BR)
2026-10-25 03:28:27 +03:00

62 lines
2.2 KiB
JavaScript

/**
* @module commands/thumbnail
* @description Display the thumbnail artwork of the currently playing track.
*/
import { CommandBuilder } from "../src/commands/index.mjs";
import { EmbedBuilder } from "@fluxerjs/core";
import { Utils } from "../src/utils/Utils.mjs";
/** @type {CommandBuilder} @description Command definition for the thumbnail command. */
export const command = new CommandBuilder()
.setName("thumbnail")
.setDescription("Request the thumbnail of the currently playing song.", "commands.thumbnail")
.addAliases("thumb")
.setCategory("music");
/**
* @async
* Run handler for the thumbnail command.
* Fetches and displays the thumbnail of the currently playing track.
* @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 current = p.queue?.getCurrent();
if (!current) {
const embed = new EmbedBuilder()
.setColor(0xe9196c)
.setDescription(this.t(msg, "responses._common.nothingPlaying"));
return msg.reply({ embeds: [embed] }).catch(() => {});
}
if (!current.thumbnail) {
const embed = new EmbedBuilder()
.setColor(0xe9196c)
.setDescription(this.t(msg, "responses.thumbnail.noArtwork"));
return msg.reply({ embeds: [embed] }).catch(() => {});
}
const trackUrl = current.spotifyUrl || current.url || null;
const rawAuthor = current.artist || (typeof current.author === "object" ? current.author?.name : current.author);
const titleDisplay = Utils.truncate(current.title || this.t(msg, "responses.play.unknownTrack"), 50);
let desc = trackUrl ? `**[${titleDisplay}](${trackUrl})**` : `**${titleDisplay}**`;
if (rawAuthor) {
desc += `\n${this.t(msg, "responses.play.byAuthor", { author: rawAuthor })}`;
}
const embed = new EmbedBuilder()
.setColor(0xe9196c)
.setAuthor({ name: `🖼️ ${this.t(msg, "responses.thumbnail.thumbTitle")}` })
.setTitle(this.t(msg, "responses.thumbnail.highRes"))
.setDescription(desc)
.setImage(current.thumbnail)
.setFooter({ text: this.t(msg, "responses.thumbnail.expandHint") });
msg.reply({ embeds: [embed] }).catch(() => {});
}