feat(ui): upgrade queue, search, lyrics, and radio embeds

- Transform %queue / %list with Now Playing thumbnail, ranked item cards, and localized footer
- Enhance %search with provider icons, artist metadata, and localized cancel options
- Polish %lyrics with album thumbnail, Synced badge, and structured header
- Redesign %radio directory with command pills and localized pagination controls
- Standardize brand color 0xe9196c across all player commands
- Add complete translations across all 6 locales (en, ar-SA, ckb, tr, de-DE, pt-BR)
This commit is contained in:
NoLogicAlan committed 2026-10-25 03:11:24 +03:00
1 parent b7f20fcb02
commit 2494bf79d6
11 files changed
+158 -71

No files matched your search

+34 -14
View File
@@ -39,9 +39,12 @@ export async function run(message, data) {
const current = p.queue.getCurrent();
const totalTracks = p.queue.size();
const prefix = this.handler.getPrefix(message.message?.guildId ?? message.channel?.guildId) || "%";
if (!current && totalTracks === 0) {
const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(this.t(message, "responses.list.empty", { prefix: this.handler.getPrefix(message.message?.guildId ?? message.channel?.guildId) }));
const embed = new EmbedBuilder()
.setColor(0xe9196c)
.setDescription(this.t(message, "responses.list.empty", { prefix }));
return message.reply({ embeds: [embed] });
}
@@ -54,23 +57,31 @@ export async function run(message, data) {
const buildEmbed = (page) => {
const safePage = (isNaN(page) || page < 1) ? 1 : Math.min(Math.floor(page), totalPages);
const loopState = p.queue.songLoop ? "🔂 Song" : p.queue.loop ? "🔁 Queue" : "🛑 Off";
const loopState = p.queue.songLoop
? `🔂 ${this.t(message, "responses.play.loopSongLabel")}`
: p.queue.loop
? `🔄 ${this.t(message, "responses.play.loopQueueLabel")}`
: this.t(message, "responses.play.loopOffLabel");
let desc = "";
const remaining = p.getQueueRemainingTime();
desc += `📋 **${totalTracks} track${totalTracks !== 1 ? "s" : ""} in queue** • ⏱️ \`${remaining}\`\n`;
const pluralStr = totalTracks === 1 ? this.t(message, "responses.play.trackSingle") : this.t(message, "responses.play.trackPlural");
const headerStr = this.t(message, "responses.list.tracksCount", { count: totalTracks, plural: pluralStr });
desc += `📋 **${headerStr}** • ⏱️ ` + "`" + remaining + "`" + "\n";
if (current) {
const elapsed = p.getCurrentElapsedDuration();
const total = p.getCurrentDuration();
const link = current.spotifyUrl || current.url || "";
let title = current.title ?? "Unknown";
let title = current.title ?? this.t(message, "responses.play.unknownTrack");
if (title.length > 50) title = title.slice(0, 47) + "...";
const titleFmt = link ? `[${title}](${link})` : title;
const rawAuthor = current.artist || (typeof current.author === "object" ? current.author?.name : current.author);
const authorStr = rawAuthor ? ` • ${rawAuthor}` : "";
desc += "\n" + this.t(message, "responses.list.nowPlaying") + "\n";
desc += `${titleFmt} • \`${elapsed} / ${total}\`\n`;
desc += `\n▶️ **${this.t(message, "responses.list.nowPlayingHeader")}:**\n`;
desc += `${titleFmt}${authorStr} • ` + "`" + elapsed + " / " + total + "`" + "\n";
}
desc += `\n`;
@@ -78,26 +89,35 @@ export async function run(message, data) {
if (totalTracks === 0) {
desc += this.t(message, "responses.list.emptyInline");
} else {
desc += `**${this.t(message, "responses.list.upNextHeader")}:**\n`;
const { items, start } = p.queue.getPage(safePage, PAGE_SIZE);
items.forEach((vid, i) => {
const index = String(start + i + 1).padStart(2, " ");
const index = start + i + 1;
const dur = vid.duration ? p.getDuration(vid.duration) : "?:??";
const link = vid.spotifyUrl || vid.url || "";
let title = vid.title ?? "Unknown";
let title = vid.title ?? this.t(message, "responses.play.unknownTrack");
if (title.length > 45) title = title.slice(0, 42) + "...";
title = link ? `[${title}](${link})` : title;
const upNext = (start + i === 0) ? " ▶" : "";
desc += `\`${index}.\` ${title}${upNext} • \`${dur}\`\n`;
const rawAuthor = vid.artist || (typeof vid.author === "object" ? vid.author?.name : vid.author);
const authorStr = rawAuthor ? ` • ${rawAuthor}` : "";
desc += "`#" + index + "` " + `**${title}**${authorStr} • ` + "`" + dur + "`" + "\n";
});
}
return new EmbedBuilder()
.setColor(getGlobalColor())
const footerText = `${this.t(message, "responses.list.pageFooter", { page: safePage, totalPages, loopState })} • ${this.t(message, "responses.play.controlsHint", { prefix })}`;
const builder = new EmbedBuilder()
.setColor(0xe9196c)
.setAuthor({ name: this.t(message, "responses.list.queueTitle") })
.setDescription(desc.trim())
.setFooter({ text: `Page ${safePage}/${totalPages} • ${loopState}` })
;
.setFooter({ text: footerText });
if (current?.thumbnail) {
builder.setThumbnail(current.thumbnail);
}
return builder;
};
new QueuePaginator(message, this.messages, this.client)
+16 -14
View File
@@ -143,7 +143,7 @@ export async function run(message, data) {
} else {
current = p?.queue?.getCurrent() ?? null;
if (!current) {
const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(this.t(message, "responses.lyrics.nothingPlaying"));
const embed = new EmbedBuilder().setColor(0xe9196c).setDescription(this.t(message, "responses.lyrics.nothingPlaying"));
return message.reply({ embeds: [embed] });
}
searchTitle = current.title;
@@ -152,14 +152,14 @@ export async function run(message, data) {
let frame = 0;
const loadingMsg = await message.reply({ embeds: [
new EmbedBuilder().setColor(getGlobalColor())
new EmbedBuilder().setColor(0xe9196c)
.setDescription(`${LOADING_FRAMES[0]} ` + this.t(message, "responses.lyrics.searching", { title: Utils.truncate(searchTitle, 40) }))
] });
const loadingInterval = setInterval(() => {
frame = (frame + 1) % LOADING_FRAMES.length;
loadingMsg.edit({ embeds: [
new EmbedBuilder().setColor(getGlobalColor())
new EmbedBuilder().setColor(0xe9196c)
.setDescription(`${LOADING_FRAMES[frame]} ` + this.t(message, "responses.lyrics.searching", { title: Utils.truncate(searchTitle, 40) }))
] }).catch(() => {});
}, 800);
@@ -176,7 +176,7 @@ export async function run(message, data) {
if (!result || !result.text) {
return loadingMsg.edit({ embeds: [
new EmbedBuilder().setColor(getGlobalColor())
new EmbedBuilder().setColor(0xe9196c)
.setDescription(
this.t(message, "responses.lyrics.noLyrics", { title: Utils.truncate(searchTitle, 40) })
)
@@ -229,16 +229,17 @@ export async function run(message, data) {
}
if (totalPages === 1) {
const headerLine = `by *${artist}*${syncIndicator}`;
const headerLine = `by **${artist}**${syncIndicator ? " • " + syncIndicator : ""}`;
const descBody = pages[0];
const singleDesc = [headerLine, "", "```", descBody, "```"].join("\n");
const singleEmbed = new EmbedBuilder()
.setColor(getGlobalColor())
.setTitle(`🎵 ${Utils.truncate(displayTitle, 50)}`)
.setColor(0xe9196c)
.setAuthor({ name: "🎤 Lyrics" })
.setTitle(Utils.truncate(displayTitle, 50))
.setDescription(singleDesc.slice(0, MAX_DESC))
.setFooter({ text: this.t(message, "responses.lyrics.sourceFooter", { source: result.source, lines: totalLines }) });
if (current.thumbnail) singleEmbed.setThumbnail(current.thumbnail);
if (current?.thumbnail) singleEmbed.setThumbnail(current.thumbnail);
return message.reply({ embeds: [singleEmbed] });
}
@@ -253,18 +254,19 @@ export async function run(message, data) {
* @returns {object} Embed payload for message reply/edit.
*/
const buildContent = (pageIdx, expired = false) => {
const headerLine = `by *${artist}*${syncIndicator} • Page ${pageIdx + 1}/${totalPages}`;
const headerLine = `by **${artist}**${syncIndicator ? " • " + syncIndicator : ""} • Page ${pageIdx + 1}/${totalPages}`;
const descBody = pages[pageIdx];
const desc = [headerLine, "", "```", descBody, "```"].join("\n");
const b = new EmbedBuilder()
.setColor(getGlobalColor())
.setTitle(`🎵 ${Utils.truncate(displayTitle, 50)}`)
.setColor(0xe9196c)
.setAuthor({ name: "🎤 Lyrics" })
.setTitle(Utils.truncate(displayTitle, 50))
.setDescription(desc.slice(0, MAX_DESC))
.setFooter({ text: expired
? this.t(message, "responses.lyrics.controlsExpired", { lines: totalLines })
: this.t(message, "responses.lyrics.sourceFooter", { source: result.source, lines: totalLines }) });
if (current.thumbnail) b.setThumbnail(current.thumbnail);
if (current?.thumbnail) b.setThumbnail(current.thumbnail);
return { embeds: [b] };
};
@@ -322,7 +324,7 @@ export async function run(message, data) {
const closedHeader = `by *${artist}*${syncIndicator} • Page ${currentPage + 1}/${totalPages}`;
const closedDesc = [closedHeader, "", "```", pages[currentPage], "```"].join("\n");
const closedEmbed = new EmbedBuilder()
.setColor(getGlobalColor())
.setColor(0xe9196c)
.setTitle(`🎵 ${Utils.truncate(displayTitle, 50)}`)
.setDescription(closedDesc.slice(0, MAX_DESC))
.setFooter({ text: this.t(message, "responses.lyrics.sessionClosed", { lines: totalLines }) });
@@ -332,6 +334,6 @@ export async function run(message, data) {
} catch (err) {
clearInterval(loadingInterval);
logger.error("[Lyrics Command] Error:", err);
loadingMsg.edit({ embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(this.t(message, "responses.lyrics.error", { error: Utils.truncate(err.message, 100) }))] }).catch(() => {});
loadingMsg.edit({ embeds: [new EmbedBuilder().setColor(0xe9196c).setDescription(this.t(message, "responses.lyrics.error", { error: Utils.truncate(err.message, 100) }))] }).catch(() => {});
}
}
+4 -4
View File
@@ -53,9 +53,9 @@ export function buildPlayerEmbed(bot, msg, player, timeout, state = {}) {
let filterStatus = bot.t(msg, "responses.player.filterOff");
if (player.activeFilter) {
if (player.activeFilter.label.includes("+")) {
filterStatus = `🔥 **${player.activeFilter.label}**`;
filterStatus = bot.t(msg, "responses.player.filterStacked", { label: player.activeFilter.label });
} else {
filterStatus = `${player.activeFilter.emoji ?? "🎛️"} **${player.activeFilter.label}**`;
filterStatus = bot.t(msg, "responses.player.filterActive", { emoji: player.activeFilter.emoji ?? "🎛️", label: player.activeFilter.label });
}
}
@@ -71,7 +71,7 @@ export function buildPlayerEmbed(bot, msg, player, timeout, state = {}) {
`${timeDisplay}`,
``,
bot.t(msg, "responses.player.volumeLabel", { volume: volPercent }) + " " + volumeBar,
`${bot.t(msg, "responses.player.queueLabel", { count: queueSize })} | Loop: ${loopStatus} | Filter: ${filterStatus}`,
`${bot.t(msg, "responses.player.queueLabel", { count: queueSize })} • ${loopStatus} • ${filterStatus}`,
``,
state.message ? `💬 *${state.message}*` : `💡 *${bot.t(msg, "responses.player.reactHint")}*`,
``,
@@ -83,7 +83,7 @@ export function buildPlayerEmbed(bot, msg, player, timeout, state = {}) {
: msg.author?.avatarURL ?? null;
const builder = new EmbedBuilder()
.setColor(getGlobalColor())
.setColor(0xe9196c)
.setTitle(bot.t(msg, "responses.player.title"))
.setDescription(description)
.setFooter({
+20 -7
View File
@@ -50,17 +50,29 @@ export async function run(msg, data) {
const buildPage = () => {
const start = page * perPage;
const pickable = radios.slice(start, start + perPage);
const prefix = this.handler.getPrefix(msg.message?.guildId ?? msg.channel?.guildId) || "%";
let desc = `📻 **Radio Stations (Page ${page + 1}/${totalPages})**\n\n`;
let desc = "";
pickable.forEach((r, i) => {
const displayName = r.detailedName ?? r.name ?? "Station";
const stationDesc = String(r.description ?? "").replaceAll("\n", "\n ");
desc += `${NUMBER_EMOJIS[i]} **${displayName}** (\`${r.name ?? "station"}\`)\n`;
desc += ` ${stationDesc}\n\n`;
desc += `${NUMBER_EMOJIS[i]} **${displayName}** (\`${prefix}radio ${r.name ?? "station"}\`)\n`;
if (stationDesc) desc += ` ${stationDesc}\n\n`;
else desc += "\n";
});
desc += `⬅️ Previous ➡️ Next ❌ Cancel`;
return { payload: { embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc)] }, pickable };
const authorName = this.t(msg, "responses.radio.stationsAuthor") || "24/7 Radio Station Directory";
const titleName = this.t(msg, "responses.radio.stationsTitle", { page: page + 1, total: totalPages });
const footerText = this.t(msg, "responses.radio.prevNext");
const embed = new EmbedBuilder()
.setColor(0xe9196c)
.setAuthor({ name: authorName })
.setTitle(titleName)
.setDescription(desc.trim())
.setFooter({ text: footerText });
return { payload: { embeds: [embed] }, pickable };
};
let { payload, pickable } = buildPage();
@@ -165,13 +177,14 @@ async function playStation(ctx, msg, radio, editTarget = null) {
const stationLine = stationUrl
? `**[${stationName}](${stationUrl})**\n\n`
: `**${stationName}**\n\n`;
const skipHint = ctx.t(msg, "responses.radio.skipHint", { prefix }) || `_Use \`${prefix}skip\` to stop the radio, or \`${prefix}radio list\` to switch stations._`;
const embed = new EmbedBuilder()
.setColor(getGlobalColor())
.setColor(0xe9196c)
.setTitle(`📻 ${stationName}`)
.setDescription(
stationLine +
`${stationDesc}\n\n` +
`_Use \`${prefix}skip\` to stop the radio, or \`${prefix}radio list\` to switch stations._`
skipHint
)
;
+30 -14
View File
@@ -8,6 +8,7 @@ import { Message, getGlobalColor } from "../src/ui/index.mjs";
import { EmbedBuilder } from "@fluxerjs/core";
import { PROVIDER_CHOICES, PROVIDER_NAMES, parseInlineProvider } from "../src/music/providers.mjs";
import { NUMBER_EMOJIS, CANCEL_EMOJI } from "../src/utils/UI.mjs";
import { Utils } from "../src/utils/Utils.mjs";
import { logger } from "../src/core/Logger.mjs";
/** @type {CommandBuilder} @description Command definition for the search command. */
@@ -61,26 +62,35 @@ export async function run(msg, data) {
const channel = msg.channel?.channel ?? msg.message?.channel;
if (!channel?.send) return;
let providerIcon = "🔍";
if (provider === "sp" || provider === "spotify") providerIcon = "🟢";
else if (provider === "sc" || provider === "soundcloud") providerIcon = "🟠";
else if (provider === "yt" || provider === "ytm" || provider === "youtube") providerIcon = "▶️";
const authorTitle = `${providerIcon} ${this.t(msg, "responses.search.resultsTitle", { provider: name })}`;
/**
* @private
* Build a search result embed.
* @param {string} description - The embed description text.
* @param {string|null} footerText - Optional footer text.
* @param {string} [authorLabel=name] - The author field label (provider name).
* @param {string} [authorLabel=authorTitle] - The author field label.
* @param {string|null} [thumbnail=null] - Optional thumbnail URL.
* @returns {EmbedBuilder} The constructed embed.
*/
const makeEmbed = (description, footerText, authorLabel = name) => {
const makeEmbed = (description, footerText, authorLabel = authorTitle, thumbnail = null) => {
const b = new EmbedBuilder()
.setColor(getGlobalColor())
.setColor(0xe9196c)
.setAuthor({ name: authorLabel })
.setDescription(description);
if (thumbnail) b.setThumbnail(thumbnail);
if (footerText) b.setFooter({ text: footerText });
return b;
};
const nativeMsg = msg.message ?? msg;
const rawMsg = await nativeMsg.reply(
{ embeds: [makeEmbed(this.t(msg, "responses.search.loadingResults"), this.t(msg, "responses.play.searchingProvider", { provider: name }), this.t(msg, "responses.search.resultsTitle", { provider: name }))]},
{ embeds: [makeEmbed(this.t(msg, "responses.search.loadingResults"), this.t(msg, "responses.play.searchingProvider", { provider: name }), authorTitle)]},
{ ping: false }
).catch(() => null);
if (!rawMsg) return;
@@ -94,20 +104,25 @@ export async function run(msg, data) {
const results = p.searches.get(msg.authorId) ?? [];
const reactions = NUMBER_EMOJIS.slice(0, res.count);
const cancelText = this.t(msg, "responses.search.cancelOption") || "Cancel";
let desc = "";
results.forEach((v, i) => {
const dur = v.duration ? p.getDuration(v.duration) : "?:??";
const title = v.title || "Unknown";
const url = v.url || "";
desc += `${NUMBER_EMOJIS[i]} [${title}](${url}) — \`${dur}\`\n`;
const dur = v.duration ? p.getDuration(v.duration) : "?:??";
const rawAuthor = v.artist || (typeof v.author === "object" ? v.author?.name : v.author);
const authorStr = rawAuthor ? ` • ${Utils.truncate(rawAuthor, 30)}` : "";
const title = Utils.truncate(v.title || this.t(msg, "responses.play.unknownTrack"), 50);
const url = v.url || "";
const titleFmt = url ? `[${title}](${url})` : title;
desc += `${NUMBER_EMOJIS[i]} **${titleFmt}**${authorStr} • \`${dur}\`\n\n`;
});
desc += `\n${CANCEL_EMOJI} Cancel`;
desc += `${CANCEL_EMOJI} ${cancelText}`;
await rawMsg.edit({
embeds: [makeEmbed(
desc,
desc.trim(),
this.t(msg, "responses.search.reactHint"),
this.t(msg, "responses.search.resultsTitle", { provider: name })
authorTitle,
results[0]?.thumbnail || null
)]
}).catch(() => {});
@@ -145,7 +160,7 @@ export async function run(msg, data) {
if (e.emoji_id === CANCEL_EMOJI) {
p.searches.delete(msg.authorId);
rawMsg.edit({
embeds: [makeEmbed(this.t(msg, "responses.search.cancelled"), null, this.t(msg, "responses.search.resultsTitle", { provider: name }))]
embeds: [makeEmbed(this.t(msg, "responses.search.cancelled"), null, authorTitle)]
}).catch(() => {});
return;
}
@@ -160,7 +175,8 @@ export async function run(msg, data) {
embeds: [makeEmbed(
this.t(msg, "responses.search.added", { title: v.title, url: v.url }),
null,
this.t(msg, "responses.search.resultsTitle", { provider: name })
authorTitle,
v.thumbnail || null
)]
}).catch(() => {});
});
@@ -171,7 +187,7 @@ export async function run(msg, data) {
p.searches.delete(msg.authorId);
clearReactions().catch(() => {});
rawMsg.edit({
embeds: [makeEmbed(this.t(msg, "responses.search.timedOut"), this.t(msg, "responses.search.sessionClosed"), this.t(msg, "responses.search.resultsTitle", { provider: name }))]
embeds: [makeEmbed(this.t(msg, "responses.search.timedOut"), this.t(msg, "responses.search.sessionClosed"), authorTitle)]
}).catch(() => {});
}, SESSION_MS);
}