feat(ui): upgrade playback action embeds

- Redesign %skip with skipped track thumbnail, elapsed time, and up-next preview
- Upgrade %pause and %resume with rich track cards and timestamp badges
- Add visual volume meter gauge (0-150%) to %volume
- Modernize %loop with single-track and queue-loop status badges
- Enhance %autoplay with status pills and recommendation engine details
- Polish %shuffle and %clear with queue reorder summaries and track counts
- Full translations added across all 6 locales (en, ar-SA, ckb, tr, de-DE, pt-BR)
This commit is contained in:
NoLogicAlan committed 2026-10-25 03:19:11 +03:00
1 parent 2494bf79d6
commit 8874ed1ec6
14 files changed
+477 -102

No files matched your search

+18 -10
View File
@@ -579,6 +579,8 @@ export async function run(msg, data) {
const p = await this.getPlayer(msg, true, true, false);
if (!p) return;
const prefix = this.handler.getPrefix(msg.message?.guildId ?? msg.channel?.guildId) || "%";
p._autoplay = !p._autoplay;
if (p._autoplay) {
@@ -589,11 +591,14 @@ export async function run(msg, data) {
p._autoplayHandler().catch(() => {});
}
return msg.reply({
embeds: [new EmbedBuilder()
.setColor(getGlobalColor())
.setDescription(this.t(msg, "responses.autoplay.enabled"))]
});
const embed = new EmbedBuilder()
.setColor(0xe9196c)
.setAuthor({ name: `🔁 ${this.t(msg, "responses.autoplay.autoplayTitleEnabled")}` })
.setTitle("🟢 Active")
.setDescription(this.t(msg, "responses.autoplay.autoplayDescEnabled"))
.setFooter({ text: `${this.t(msg, "responses.autoplay.autoplayEngine")} • ${prefix}autoplay to disable` });
return msg.reply({ embeds: [embed] });
} else {
detachAutoplay(p);
p._autoplayHistory = [];
@@ -606,10 +611,13 @@ export async function run(msg, data) {
p._autoplaySeedTags = null;
p._autoplayPickedVids = null;
return msg.reply({
embeds: [new EmbedBuilder()
.setColor(getGlobalColor())
.setDescription(this.t(msg, "responses.autoplay.disabled"))]
});
const embed = new EmbedBuilder()
.setColor(0xe9196c)
.setAuthor({ name: `⏹️ ${this.t(msg, "responses.autoplay.autoplayTitleDisabled")}` })
.setTitle("🔴 Disabled")
.setDescription(this.t(msg, "responses.autoplay.autoplayDescDisabled"))
.setFooter({ text: `${prefix}autoplay to enable` });
return msg.reply({ embeds: [embed] });
}
}
+10 -4
View File
@@ -5,7 +5,6 @@
import { CommandBuilder } from "../src/commands/index.mjs";
import { EmbedBuilder } from "@fluxerjs/core";
import { getGlobalColor } from "../src/ui/index.mjs";
/**
* @type {CommandBuilder}
@@ -52,10 +51,17 @@ export async function run(msg, data) {
return msg.replyEmbed(res).catch(() => {});
}
const count = p.queue.size();
p.clear();
const pluralStr = count === 1 ? this.t(msg, "responses.play.trackSingle") : this.t(msg, "responses.play.trackPlural");
const prefix = this.handler.getPrefix(msg.message?.guildId ?? msg.channel?.guildId) || "%";
const embed = new EmbedBuilder()
.setColor(getGlobalColor())
.setDescription(this.t(msg, "responses.clear.cleared"))
;
.setColor(0xe9196c)
.setAuthor({ name: `🗑️ ${this.t(msg, "responses.clear.clearedTitle")}` })
.setTitle(this.t(msg, "responses.clear.cleared"))
.setDescription(this.t(msg, "responses.clear.clearedSummary", { count, plural: pluralStr }))
.setFooter({ text: `${prefix}play <song> to start a new queue` });
msg.reply({ embeds: [embed] }).catch(() => {});
}
+40 -5
View File
@@ -5,7 +5,7 @@
import { CommandBuilder } from "../src/commands/index.mjs";
import { EmbedBuilder } from "@fluxerjs/core";
import { getGlobalColor } from "../src/ui/index.mjs";
import { Utils } from "../src/utils/Utils.mjs";
/** @type {CommandBuilder} @description Command definition for the loop command. */
export const command = new CommandBuilder()
@@ -29,10 +29,45 @@ export const command = new CommandBuilder()
export async function run(message, data) {
const p = await this.getPlayer(message);
if (!p) return;
const res = p.loop(data.get("type").value);
const type = data.get("type").value;
const current = p.queue.getCurrent();
const prefix = this.handler.getPrefix(message.message?.guildId ?? message.channel?.guildId) || "%";
const state = p.queue.toggleLoop(type);
let badge = this.t(message, "responses.loop.loopOffBadge");
let desc = this.t(message, "responses.loop.loopOffDesc");
let icon = "⏹️";
if (state) {
if (type === "song") {
badge = this.t(message, "responses.loop.songLoopBadge");
desc = this.t(message, "responses.loop.songLoopDesc");
icon = "🔂";
} else {
badge = this.t(message, "responses.loop.queueLoopBadge");
desc = this.t(message, "responses.loop.queueLoopDesc");
icon = "🔄";
}
}
if (current?.title) {
const rawAuthor = current.artist || (typeof current.author === "object" ? current.author?.name : current.author);
const authorStr = rawAuthor ? ` • ${rawAuthor}` : "";
desc += `\n**${Utils.truncate(current.title, 45)}**${authorStr}`;
}
const embed = new EmbedBuilder()
.setColor(getGlobalColor())
.setDescription(res)
;
.setColor(0xe9196c)
.setAuthor({ name: `${icon} ${this.t(message, "responses.loop.loopTitle")}` })
.setTitle(badge)
.setDescription(desc)
.setFooter({ text: `Cycle: ${prefix}loop song • ${prefix}loop queue` });
if (current?.thumbnail) {
embed.setThumbnail(current.thumbnail);
}
message.reply({ embeds: [embed] }).catch(() => {});
}
+37 -5
View File
@@ -5,7 +5,7 @@
import { CommandBuilder } from "../src/commands/index.mjs";
import { EmbedBuilder } from "@fluxerjs/core";
import { getGlobalColor } from "../src/ui/index.mjs";
import { Utils } from "../src/utils/Utils.mjs";
/** @type {CommandBuilder} @description Command definition for the pause command. */
export const command = new CommandBuilder()
@@ -23,10 +23,42 @@ export const command = new CommandBuilder()
export async function run(message) {
const p = await this.getPlayer(message);
if (!p) return;
const res = p.pause();
const current = p.queue.getCurrent();
if (!p.connection || !current) {
const embed = new EmbedBuilder().setColor(0xe9196c).setDescription(this.t(message, "responses._common.nothingPlaying"));
return message.reply({ embeds: [embed] });
}
if (p._paused) {
const embed = new EmbedBuilder().setColor(0xe9196c).setDescription(this.t(message, "responses.pause.alreadyPaused") || "Already paused!");
return message.reply({ embeds: [embed] });
}
p.pause();
const elapsed = p.getCurrentElapsedDuration();
const trackUrl = current.spotifyUrl || current.url || null;
const rawAuthor = current.artist || (typeof current.author === "object" ? current.author?.name : current.author);
const prefix = this.handler.getPrefix(message.message?.guildId ?? message.channel?.guildId) || "%";
let desc = trackUrl
? `**[${Utils.truncate(current.title || this.t(message, "responses.play.unknownTrack"), 50)}](${trackUrl})**`
: `**${Utils.truncate(current.title || this.t(message, "responses.play.unknownTrack"), 50)}**`;
if (rawAuthor) {
desc += `\n${this.t(message, "responses.play.byAuthor", { author: rawAuthor })}`;
}
const embed = new EmbedBuilder()
.setColor(getGlobalColor())
.setDescription(res)
;
.setColor(0xe9196c)
.setAuthor({ name: `⏸️ ${this.t(message, "responses.pause.pausedTitle")}` })
.setTitle(this.t(message, "responses.pause.pausedAt", { time: elapsed }))
.setDescription(desc)
.setFooter({ text: this.t(message, "responses.pause.resumeHint", { prefix }) });
if (current.thumbnail) {
embed.setThumbnail(current.thumbnail);
}
message.reply({ embeds: [embed] }).catch(() => {});
}
+37 -5
View File
@@ -5,7 +5,7 @@
import { CommandBuilder } from "../src/commands/index.mjs";
import { EmbedBuilder } from "@fluxerjs/core";
import { getGlobalColor } from "../src/ui/index.mjs";
import { Utils } from "../src/utils/Utils.mjs";
/**
* @type {CommandBuilder}
@@ -26,10 +26,42 @@ export const command = new CommandBuilder()
export async function run(message) {
const p = await this.getPlayer(message, false, true, false);
if (!p) return;
const res = p.resume();
const current = p.queue.getCurrent();
if (!p.connection || !current) {
const embed = new EmbedBuilder().setColor(0xe9196c).setDescription(this.t(message, "responses._common.nothingPlaying"));
return message.reply({ embeds: [embed] });
}
if (!p._paused) {
const embed = new EmbedBuilder().setColor(0xe9196c).setDescription(this.t(message, "responses.resume.alreadyPlaying") || "Already playing!");
return message.reply({ embeds: [embed] });
}
p.resume();
const elapsed = p.getCurrentElapsedDuration();
const trackUrl = current.spotifyUrl || current.url || null;
const rawAuthor = current.artist || (typeof current.author === "object" ? current.author?.name : current.author);
const prefix = this.handler.getPrefix(message.message?.guildId ?? message.channel?.guildId) || "%";
let desc = trackUrl
? `**[${Utils.truncate(current.title || this.t(message, "responses.play.unknownTrack"), 50)}](${trackUrl})**`
: `**${Utils.truncate(current.title || this.t(message, "responses.play.unknownTrack"), 50)}**`;
if (rawAuthor) {
desc += `\n${this.t(message, "responses.play.byAuthor", { author: rawAuthor })}`;
}
const embed = new EmbedBuilder()
.setColor(getGlobalColor())
.setDescription(res)
;
.setColor(0xe9196c)
.setAuthor({ name: `▶️ ${this.t(message, "responses.resume.resumedTitle")}` })
.setTitle(this.t(message, "responses.resume.resumedAt", { time: elapsed }))
.setDescription(desc)
.setFooter({ text: this.t(message, "responses.resume.pauseHint", { prefix }) });
if (current.thumbnail) {
embed.setThumbnail(current.thumbnail);
}
message.reply({ embeds: [embed] }).catch(() => {});
}
+34 -5
View File
@@ -5,7 +5,7 @@
import { CommandBuilder } from "../src/commands/index.mjs";
import { EmbedBuilder } from "@fluxerjs/core";
import { getGlobalColor } from "../src/ui/index.mjs";
import { Utils } from "../src/utils/Utils.mjs";
/**
* @type {CommandBuilder}
@@ -26,10 +26,39 @@ export const command = new CommandBuilder()
export async function run(message) {
const p = await this.getPlayer(message, false, true, false);
if (!p) return;
const res = p.shuffle();
if (p.isEmpty()) {
const embed = new EmbedBuilder()
.setColor(0xe9196c)
.setDescription(this.t(message, "responses._common.nothingPlaying"));
return message.reply({ embeds: [embed] });
}
p.queue.shuffle();
p.emit("update", "queue");
const totalTracks = p.queue.size();
const pluralStr = totalTracks === 1 ? this.t(message, "responses.play.trackSingle") : this.t(message, "responses.play.trackPlural");
const nextTrack = p.queue.data?.[0];
const nextTitle = nextTrack?.title ? Utils.truncate(nextTrack.title, 40) : null;
const rawAuthor = nextTrack ? (nextTrack.artist || (typeof nextTrack.author === "object" ? nextTrack.author?.name : nextTrack.author)) : null;
const prefix = this.handler.getPrefix(message.message?.guildId ?? message.channel?.guildId) || "%";
let desc = `**${this.t(message, "responses.shuffle.shuffledSummary", { count: totalTracks, plural: pluralStr })}**`;
if (nextTitle) {
const authorStr = rawAuthor ? ` • ${rawAuthor}` : "";
desc += `\n\n▶️ **${this.t(message, "responses.shuffle.newUpNext")}:**\n${nextTitle}${authorStr}`;
}
const embed = new EmbedBuilder()
.setColor(getGlobalColor())
.setDescription(res)
;
.setColor(0xe9196c)
.setAuthor({ name: `🔀 ${this.t(message, "responses.shuffle.shuffledTitle")}` })
.setDescription(desc)
.setFooter({ text: `${prefix}queue to view full order` });
if (nextTrack?.thumbnail) {
embed.setThumbnail(nextTrack.thumbnail);
}
message.reply({ embeds: [embed] }).catch(() => {});
}
+40 -8
View File
@@ -9,6 +9,7 @@ import { CommandBuilder } from "../src/commands/index.mjs";
import { EmbedBuilder } from "@fluxerjs/core";
import { getGlobalColor, cleanId } from "../src/ui/index.mjs";
import { countHumansInChannel } from "../src/voice/VoiceStateResolver.mjs";
import { Utils } from "../src/utils/Utils.mjs";
/** @type {CommandBuilder} @description Command definition for the skip command. */
export const command = new CommandBuilder()
@@ -22,18 +23,47 @@ async function doSkip(ctx, message, p) {
const current = p.queue.getCurrent();
const skippedTitle = current?.title ?? null;
const skippedLink = current ? (current.spotifyUrl || current.url || "") : "";
const rawAuthor = current ? (current.artist || (typeof current.author === "object" ? current.author?.name : current.author)) : null;
const skippedThumb = current?.thumbnail || null;
const elapsed = p.getCurrentElapsedDuration();
const err = p.skip();
if (!p.connection || !current) {
const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(err);
const embed = new EmbedBuilder().setColor(0xe9196c).setDescription(err);
return message.reply({ embeds: [embed] });
}
const desc = skippedTitle
? ctx.t(message, "responses.skip.skippedTrack", { title: skippedTitle, url: skippedLink })
: ctx.t(message, "responses.skip.skipped");
const nextTrack = p.queue.data?.[0];
const nextTitle = nextTrack?.title ? Utils.truncate(nextTrack.title, 40) : null;
const queueCount = p.queue.size();
const pluralStr = queueCount === 1 ? ctx.t(message, "responses.play.trackSingle") : ctx.t(message, "responses.play.trackPlural");
message.reply({ embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc)] }).catch(() => {});
const authorLabel = `⏭️ ${ctx.t(message, "responses.skip.skippedTitle")}`;
const titleDisplay = skippedTitle ? Utils.truncate(skippedTitle, 50) : ctx.t(message, "responses.play.unknownTrack");
let desc = skippedLink ? `**[${titleDisplay}](${skippedLink})**` : `**${titleDisplay}**`;
if (rawAuthor) {
desc += `\n${ctx.t(message, "responses.play.byAuthor", { author: rawAuthor })}`;
}
const footerParts = [];
if (nextTitle) {
footerParts.push(`▶️ ${ctx.t(message, "responses.skip.upNext")}: ${nextTitle}`);
}
footerParts.push(ctx.t(message, "responses.skip.queueRemaining", { count: queueCount, plural: pluralStr }));
const embed = new EmbedBuilder()
.setColor(0xe9196c)
.setAuthor({ name: authorLabel })
.setTitle(ctx.t(message, "responses.skip.skippedAt", { time: elapsed }))
.setDescription(desc)
.setFooter({ text: footerParts.join(" • ") });
if (skippedThumb) {
embed.setThumbnail(skippedThumb);
}
message.reply({ embeds: [embed] }).catch(() => {});
}
/**
@@ -51,7 +81,7 @@ export async function run(message) {
const current = p.queue.getCurrent();
if (!p.connection || !current) {
const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(this.t(message, "responses._common.nothingPlaying"));
const embed = new EmbedBuilder().setColor(0xe9196c).setDescription(this.t(message, "responses._common.nothingPlaying"));
return message.reply({ embeds: [embed] });
}
@@ -81,7 +111,8 @@ export async function run(message) {
const needed = Math.floor(humanCount / 2) + 1;
if (p._skipVotes.has(userId)) {
const embed = new EmbedBuilder().setColor(getGlobalColor())
const embed = new EmbedBuilder().setColor(0xe9196c)
.setAuthor({ name: `🗳️ ${this.t(message, "responses.skip.skippedTitle")}` })
.setDescription(this.t(message, "responses.skip.alreadyVoted", { votes: p._skipVotes.size, needed }));
return message.reply({ embeds: [embed] }).catch(() => {});
}
@@ -93,7 +124,8 @@ export async function run(message) {
return doSkip(this, message, p);
}
const embed = new EmbedBuilder().setColor(getGlobalColor())
const embed = new EmbedBuilder().setColor(0xe9196c)
.setAuthor({ name: `🗳️ ${this.t(message, "responses.skip.skippedTitle")}` })
.setDescription(this.t(message, "responses.skip.voteAdded", { votes: p._skipVotes.size, needed }));
message.reply({ embeds: [embed] }).catch(() => {});
}
+33 -12
View File
@@ -5,10 +5,8 @@
import { CommandBuilder } from "../src/commands/index.mjs";
import { EmbedBuilder } from "@fluxerjs/core";
import { getGlobalColor } from "../src/ui/index.mjs";
import { MAX_VOLUME } from "../src/utils/UI.mjs";
/**
* @type {CommandBuilder}
* @description Command definition for the volume command.
@@ -38,21 +36,44 @@ export async function run(message, data) {
const volOption = data.get("volume");
const raw = volOption?.value;
const prefix = this.handler.getPrefix(message.message?.guildId ?? message.channel?.guildId) || "%";
const embed = new EmbedBuilder().setColor(getGlobalColor());
const makeVolumeBar = (pct) => {
const bars = Math.min(15, Math.max(0, Math.round(pct / 10)));
return "█".repeat(bars) + "░".repeat(15 - bars);
};
if (!volOption || raw === null || raw === undefined || isNaN(Number(raw))) {
const current = Math.round((p.preferredVolume ?? 1) * 100);
embed.setDescription(this.t(message, "responses.volume.current", { volume: current }));
} else {
const pct = Number(raw);
if (pct < 0 || pct > MAX_VOLUME) {
embed.setDescription(this.t(message, "responses.volume.outOfRange", { max: MAX_VOLUME }));
} else {
p.setVolume(pct / 100);
embed.setDescription(this.t(message, "responses.volume.changed", { volume: pct }));
}
const bar = makeVolumeBar(current);
const embed = new EmbedBuilder()
.setColor(0xe9196c)
.setAuthor({ name: `🔊 ${this.t(message, "responses.volume.currentVolume")}` })
.setTitle(`\`${current}%\``)
.setDescription(`\`0%\` ${bar} \`${MAX_VOLUME}%\`\n\n${this.t(message, "responses.volume.current", { volume: current })}`)
.setFooter({ text: this.t(message, "responses.volume.volumeHint", { prefix }) });
return message.reply({ embeds: [embed] }).catch(() => {});
}
const pct = Number(raw);
if (pct < 0 || pct > MAX_VOLUME) {
const embed = new EmbedBuilder()
.setColor(0xe9196c)
.setDescription(this.t(message, "responses.volume.outOfRange", { max: MAX_VOLUME }));
return message.reply({ embeds: [embed] }).catch(() => {});
}
p.setVolume(pct / 100);
const bar = makeVolumeBar(pct);
const embed = new EmbedBuilder()
.setColor(0xe9196c)
.setAuthor({ name: `🔊 ${this.t(message, "responses.volume.volumeAdjusted")}` })
.setTitle(`\`${pct}%\``)
.setDescription(`\`0%\` ${bar} \`${MAX_VOLUME}%\`\n\n${this.t(message, "responses.volume.changed", { volume: pct })}`)
.setFooter({ text: this.t(message, "responses.volume.volumeHint", { prefix }) });
message.reply({ embeds: [embed] }).catch(() => {});
}