mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
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)
This commit is contained in:
1 parent
8874ed1ec6
commit
4c3c04bd7d
14 files changed
+456
-119
No files matched your search
+36
-5
@@ -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";
|
||||
|
||||
export const BASSBOOST_PRESETS = {
|
||||
low: {
|
||||
@@ -59,7 +59,7 @@ export const command = new CommandBuilder()
|
||||
o.setName("level")
|
||||
.setDescription("Bass boost level: 'low', 'medium', 'hard', or 'off'.", "options.bassboost.level")
|
||||
.addChoices("low", "medium", "hard", "off")
|
||||
.setRequired(false)
|
||||
.setDefault("medium")
|
||||
)
|
||||
.addAliases("bb", "bass");
|
||||
|
||||
@@ -74,13 +74,18 @@ export async function run(message, data) {
|
||||
const p = await this.getPlayer(message, false, false, false);
|
||||
if (!p) return;
|
||||
|
||||
const current = p.queue?.getCurrent();
|
||||
const levelArg = data.get("level")?.value?.toLowerCase() || "medium";
|
||||
const prefix = this.handler.getPrefix(message.message?.guildId ?? message.channel?.guildId) || "%";
|
||||
|
||||
const embed = new EmbedBuilder().setColor(getGlobalColor());
|
||||
const embed = new EmbedBuilder().setColor(0xe9196c);
|
||||
|
||||
if (levelArg === "off" || levelArg === "none" || levelArg === "reset") {
|
||||
await p.applyFilter({}, null);
|
||||
embed.setDescription(this.t(message, "responses.bassboost.disabled"));
|
||||
embed.setAuthor({ name: `🔊 ${this.t(message, "responses.bassboost.eqTitle")}` })
|
||||
.setTitle("⏹️ Bass Boost Off")
|
||||
.setDescription(this.t(message, "responses.bassboost.disabled"))
|
||||
.setFooter({ text: `${prefix}bassboost <low|medium|hard>` });
|
||||
return message.reply({ embeds: [embed] }).catch(() => {});
|
||||
}
|
||||
|
||||
@@ -97,6 +102,32 @@ export async function run(message, data) {
|
||||
return message.reply({ embeds: [embed] }).catch(() => {});
|
||||
}
|
||||
|
||||
embed.setDescription(this.t(message, "responses.bassboost.applied", { level: preset.label }));
|
||||
let desc = this.t(message, "responses.bassboost.applied", { level: preset.label });
|
||||
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 subBassText = this.t(message, "responses.bassboost.subBass") || "Sub-Bass";
|
||||
const midBassText = this.t(message, "responses.bassboost.midBass") || "Mid-Bass";
|
||||
const highText = this.t(message, "responses.bassboost.high") || "High";
|
||||
|
||||
const gainSub = levelArg === "hard" ? "+1.10 dB" : levelArg === "low" ? "+0.25 dB" : "+0.70 dB";
|
||||
const gainMid = levelArg === "hard" ? "+0.80 dB" : levelArg === "low" ? "+0.15 dB" : "+0.50 dB";
|
||||
const gainHigh = levelArg === "hard" ? "-0.80 dB" : levelArg === "low" ? "+0.00 dB" : "-0.65 dB";
|
||||
|
||||
desc += `\n\n` + "`" + `${subBassText}: ${gainSub} │ ${midBassText}: ${gainMid} │ ${highText}: ${gainHigh}` + "`";
|
||||
|
||||
embed
|
||||
.setAuthor({ name: `🔊 ${this.t(message, "responses.bassboost.eqTitle")}` })
|
||||
.setTitle(`Bass Boost: ${preset.label}`)
|
||||
.setDescription(desc)
|
||||
.setFooter({ text: this.t(message, "responses.bassboost.resetHint", { prefix }) });
|
||||
|
||||
if (current?.thumbnail) {
|
||||
embed.setThumbnail(current.thumbnail);
|
||||
}
|
||||
|
||||
message.reply({ embeds: [embed] }).catch(() => {});
|
||||
}
|
||||
+14
-9
@@ -260,7 +260,7 @@ function buildPageEmbed(t, msg, page, activeKeys, current) {
|
||||
const lines = pageItems.map(f => {
|
||||
const isActive = activeSet.has(f.key);
|
||||
const active = isActive ? " " + t(msg, "responses.filter.activeLabel") : "";
|
||||
return `${f.emoji} **${f.label}**${active} — *${f.desc}*`;
|
||||
return `${f.emoji} **${f.label}**${active}\n *${f.desc}*`;
|
||||
});
|
||||
|
||||
const navHint = totalPages > 1
|
||||
@@ -273,21 +273,26 @@ function buildPageEmbed(t, msg, page, activeKeys, current) {
|
||||
const f = FILTERS.find(f => f.key === k);
|
||||
return f ? `${f.emoji} ${f.label}` : k;
|
||||
});
|
||||
activeSummary = `\n🔥 Active: ${activeLabels.join(" + ")}\n`;
|
||||
activeSummary = `\n🟢 **${t(msg, "responses.filter.activePrefix") || "Active:"}** ${activeLabels.join(" + ")}\n`;
|
||||
}
|
||||
|
||||
return new EmbedBuilder()
|
||||
.setColor(getGlobalColor())
|
||||
.setAuthor({ name: t(msg, "responses.filter.pickerTitle") })
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xe9196c)
|
||||
.setAuthor({ name: `🎛️ ${t(msg, "responses.filter.pickerTitle")}` })
|
||||
.setDescription(
|
||||
`${trackLine}\n${activeSummary}\n` +
|
||||
lines.join("\n") +
|
||||
lines.join("\n\n") +
|
||||
navHint
|
||||
)
|
||||
.setFooter({
|
||||
text: t(msg, "responses.filter.footer", { page: page + 1, total: totalPages })
|
||||
})
|
||||
;
|
||||
text: `${t(msg, "responses.filter.footer", { page: page + 1, total: totalPages })} • ${t(msg, "responses.filter.realtimeDsp") || "Real-time DSP"}`
|
||||
});
|
||||
|
||||
if (current?.thumbnail) {
|
||||
embed.setThumbnail(current.thumbnail);
|
||||
}
|
||||
|
||||
return embed;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+17
-2
@@ -155,8 +155,23 @@ export async function run(msg, data) {
|
||||
}, rejoinDelay);
|
||||
}
|
||||
|
||||
const prefix = this.handler.getPrefix(cleanGuildId) || "%";
|
||||
const chObj = client?.channels?.get?.(activeChannelId);
|
||||
const channelName = chObj?.name ? `#${chObj.name}` : `<#${activeChannelId}>`;
|
||||
|
||||
const label247 = was247
|
||||
? " (rejoining in " + Math.round(rejoinDelay / 1000) + "s — 24/7 is still saved. Use `" + this.handler.getPrefix(cleanGuildId) + "247` to disable it.)"
|
||||
? "\n\n⏱️ " + "*(rejoining in " + Math.round(rejoinDelay / 1000) + "s — 24/7 is still saved. Use `" + prefix + "247` to disable it.)*"
|
||||
: "";
|
||||
msg.reply(this.t(msg, "responses.leave.left") + label247);
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xe9196c)
|
||||
.setAuthor({ name: `👋 ${this.t(msg, "responses.leave.sessionEndedTitle")}` })
|
||||
.setTitle(this.t(msg, "responses.leave.disconnectedBadge"))
|
||||
.setDescription(
|
||||
`🔊 **${this.t(msg, "responses.leave.leftChannel", { channel: channelName })}**\n` +
|
||||
`🗑️ ${this.t(msg, "responses.leave.queueCleared")}` + label247
|
||||
)
|
||||
.setFooter({ text: this.t(msg, "responses.leave.rejoinHint", { prefix }) });
|
||||
|
||||
msg.reply({ embeds: [embed] }).catch(() => {});
|
||||
}
|
||||
+17
-13
@@ -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}
|
||||
@@ -68,7 +67,7 @@ export async function run(message) {
|
||||
const t = (...a) => this.t(message, ...a);
|
||||
|
||||
const waitingEmbed = new EmbedBuilder()
|
||||
.setColor(getGlobalColor())
|
||||
.setColor(0xe9196c)
|
||||
.setDescription(t("responses.ping.measuring"));
|
||||
|
||||
const t0 = Date.now();
|
||||
@@ -76,29 +75,34 @@ export async function run(message) {
|
||||
try {
|
||||
sent = await message.reply({ embeds: [waitingEmbed] });
|
||||
} catch (e) {
|
||||
return; // couldn't even send the placeholder — nothing to edit
|
||||
return;
|
||||
}
|
||||
const roundtrip = Date.now() - t0;
|
||||
|
||||
const lines = [
|
||||
`${t("responses.ping.roundtrip")} — \`${roundtrip}ms\``,
|
||||
];
|
||||
|
||||
const gateway = readGatewayPing(this.client);
|
||||
if (gateway >= 0) lines.push(`${t("responses.ping.gateway")} — \`${gateway}ms\``);
|
||||
|
||||
const node = readNodePing(this.lavalink);
|
||||
|
||||
const restLabel = t("responses.ping.restApi") || "REST API";
|
||||
const gatewayLabel = t("responses.ping.gatewayWs") || "Gateway WebSocket";
|
||||
const nodeLabel = t("responses.ping.audioNode") || "Audio Node";
|
||||
|
||||
const lines = [
|
||||
`⚡ **${restLabel}** — \`${roundtrip}ms\``,
|
||||
];
|
||||
if (gateway >= 0) lines.push(`🌐 **${gatewayLabel}** — \`${gateway}ms\``);
|
||||
if (node) {
|
||||
lines.push(`${t("responses.ping.node")} — \`${node.ping !== null ? node.ping + "ms" : "connected"}\``);
|
||||
lines.push(`🎵 **${nodeLabel}** — \`${node.ping !== null ? node.ping + "ms" : "connected"}\``);
|
||||
}
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(getGlobalColor())
|
||||
.setColor(0xe9196c)
|
||||
.setAuthor({
|
||||
name: t("responses.ping.title"),
|
||||
name: `🏓 ${t("responses.ping.pingDashboard") || t("responses.ping.title")}`,
|
||||
iconURL: this.client?.user?.displayAvatarURL?.() || null,
|
||||
})
|
||||
.setDescription(lines.join("\n"));
|
||||
.setTitle(`🟢 ${t("responses.ping.operational") || "Operational"}`)
|
||||
.setDescription(lines.join("\n\n"))
|
||||
.setFooter({ text: `Shard #${this.client?.shardId ?? 0} • NodeLink DSP` });
|
||||
|
||||
sent.edit({ embeds: [embed] }).catch(() => {});
|
||||
}
|
||||
+30
-11
@@ -5,7 +5,6 @@
|
||||
|
||||
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";
|
||||
|
||||
/**
|
||||
@@ -14,14 +13,14 @@ import { Utils } from "../src/utils/Utils.mjs";
|
||||
*/
|
||||
export const command = new CommandBuilder()
|
||||
.setName("pitch")
|
||||
.setDescription("Adjust the audio pitch of the current track (0.5× to 2.0×).", "commands.pitch")
|
||||
.setDescription("Adjust the pitch of the current track (0.5× to 2.0×).", "commands.pitch")
|
||||
.setCategory("music")
|
||||
.addNumberOption(o =>
|
||||
o.setName("pitch")
|
||||
.setDescription("Audio pitch multiplier between 0.5 and 2.0 (e.g. 1.25). Omit to reset to 1.0×.", "options.pitch.pitch")
|
||||
o.setName("multiplier")
|
||||
.setDescription("Pitch multiplier between 0.5 and 2.0 (e.g. 1.25). Omit to reset to 1.0×.", "options.pitch.multiplier")
|
||||
.setRequired(false)
|
||||
)
|
||||
.addAliases("semitone", "tune");
|
||||
.addAliases("key");
|
||||
|
||||
/**
|
||||
* Run handler for the pitch command.
|
||||
@@ -34,8 +33,10 @@ export async function run(message, data) {
|
||||
const p = await this.getPlayer(message, false, false, false);
|
||||
if (!p) return;
|
||||
|
||||
const rawPitch = data.get("pitch")?.value;
|
||||
const embed = new EmbedBuilder().setColor(getGlobalColor());
|
||||
const current = p.queue?.getCurrent();
|
||||
const rawPitch = data.get("multiplier")?.value;
|
||||
const prefix = this.handler?.getPrefix?.(message.message?.guildId ?? message.guild?.id) ?? "%";
|
||||
const embed = new EmbedBuilder().setColor(0xe9196c);
|
||||
|
||||
if (rawPitch === null || rawPitch === undefined || isNaN(Number(rawPitch))) {
|
||||
const currentTimescale = p.activeFilterPayload?.timescale;
|
||||
@@ -44,10 +45,15 @@ export async function run(message, data) {
|
||||
const existingPayload = { ...(p.activeFilterPayload || {}) };
|
||||
delete existingPayload.timescale;
|
||||
await p.applyFilter(existingPayload, Object.keys(existingPayload).length > 0 ? p.activeFilter : null);
|
||||
embed.setDescription(this.t(message, "responses.pitch.reset"));
|
||||
embed.setAuthor({ name: `🎵 ${this.t(message, "responses.pitch.pitchTitle")}` })
|
||||
.setTitle("1.0× Normal")
|
||||
.setDescription(this.t(message, "responses.pitch.reset"))
|
||||
.setFooter({ text: this.t(message, "responses.pitch.resetHint", { prefix }) });
|
||||
} else {
|
||||
const prefix = this.handler?.getPrefix?.(message.message?.guildId ?? message.guild?.id) ?? "%";
|
||||
embed.setDescription(this.t(message, "responses.pitch.current", { pitch: "1.0", prefix }));
|
||||
embed.setAuthor({ name: `🎵 ${this.t(message, "responses.pitch.pitchTitle")}` })
|
||||
.setTitle("1.0× Normal")
|
||||
.setDescription(this.t(message, "responses.pitch.current", { pitch: "1.0", prefix }))
|
||||
.setFooter({ text: this.t(message, "responses.pitch.resetHint", { prefix }) });
|
||||
}
|
||||
return message.reply({ embeds: [embed] }).catch(() => {});
|
||||
}
|
||||
@@ -79,6 +85,19 @@ export async function run(message, data) {
|
||||
return message.reply({ embeds: [embed] }).catch(() => {});
|
||||
}
|
||||
|
||||
embed.setDescription(this.t(message, "responses.pitch.set", { pitch }));
|
||||
let desc = this.t(message, "responses.pitch.set", { pitch });
|
||||
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}`;
|
||||
}
|
||||
|
||||
embed.setAuthor({ name: `🎵 ${this.t(message, "responses.pitch.pitchTitle")}` })
|
||||
.setTitle(this.t(message, "responses.pitch.pitchMultiplier", { pitch }))
|
||||
.setDescription(desc)
|
||||
.setFooter({ text: this.t(message, "responses.pitch.resetHint", { prefix }) });
|
||||
|
||||
if (current?.thumbnail) embed.setThumbnail(current.thumbnail);
|
||||
|
||||
message.reply({ embeds: [embed] }).catch(() => {});
|
||||
}
|
||||
+33
-10
@@ -5,9 +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";
|
||||
import { ERROR_COLOR } from "../src/utils/UI.mjs";
|
||||
|
||||
/** @type {CommandBuilder} @description Command definition for the seek command. */
|
||||
export const command = new CommandBuilder()
|
||||
@@ -35,42 +33,67 @@ export async function run(msg, data) {
|
||||
if (!p) return;
|
||||
|
||||
if (!p.queue?.getCurrent()) {
|
||||
return msg.reply({ embeds: [new EmbedBuilder().setColor(ERROR_COLOR).setDescription(this.t(msg, "responses.seek.nothingPlaying"))] });
|
||||
return msg.reply({ embeds: [new EmbedBuilder().setColor(0xe9196c).setDescription(this.t(msg, "responses.seek.nothingPlaying"))] });
|
||||
}
|
||||
|
||||
if (p._paused) {
|
||||
return msg.reply({ embeds: [new EmbedBuilder().setColor(ERROR_COLOR).setDescription(this.t(msg, "responses.seek.paused"))] });
|
||||
return msg.reply({ embeds: [new EmbedBuilder().setColor(0xe9196c).setDescription(this.t(msg, "responses.seek.paused"))] });
|
||||
}
|
||||
|
||||
const current = p.queue.getCurrent();
|
||||
|
||||
if (current?.type === "radio" || current?.isLive || p._getTrackDurationMs(current) === 0) {
|
||||
return msg.reply({ embeds: [new EmbedBuilder().setColor(ERROR_COLOR).setDescription(this.t(msg, "responses.seek.live"))] });
|
||||
return msg.reply({ embeds: [new EmbedBuilder().setColor(0xe9196c).setDescription(this.t(msg, "responses.seek.live"))] });
|
||||
}
|
||||
|
||||
const trimmed = String(positionInput ?? "").trim();
|
||||
const isZero = /^0+(:0+)?(:0+)?$/.test(trimmed);
|
||||
const seekMs = isZero ? 0 : Utils.parseDuration(trimmed);
|
||||
if (seekMs === null || isNaN(seekMs) || seekMs < 0 || (!isZero && seekMs === 0)) {
|
||||
return msg.reply({ embeds: [new EmbedBuilder().setColor(ERROR_COLOR).setDescription(this.t(msg, "responses.seek.invalidFormat"))] });
|
||||
return msg.reply({ embeds: [new EmbedBuilder().setColor(0xe9196c).setDescription(this.t(msg, "responses.seek.invalidFormat"))] });
|
||||
}
|
||||
|
||||
const trackDuration = p._getTrackDurationMs(p.queue.getCurrent());
|
||||
|
||||
if (trackDuration > 0 && seekMs >= trackDuration) {
|
||||
const maxStr = Utils.prettifyMS(trackDuration);
|
||||
return msg.reply({ embeds: [new EmbedBuilder().setColor(ERROR_COLOR).setDescription(this.t(msg, "responses.seek.exceedsDuration", { duration: maxStr }))] });
|
||||
return msg.reply({ embeds: [new EmbedBuilder().setColor(0xe9196c).setDescription(this.t(msg, "responses.seek.exceedsDuration", { duration: maxStr }))] });
|
||||
}
|
||||
|
||||
try {
|
||||
const result = await p.seekToPosition(seekMs);
|
||||
if (result) {
|
||||
const seekStr = Utils.prettifyMS(seekMs);
|
||||
return msg.reply({ embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(this.t(msg, "responses.seek.seeked", { position: seekStr }))] });
|
||||
const totalStr = Utils.prettifyMS(trackDuration);
|
||||
const trackUrl = current.spotifyUrl || current.url || null;
|
||||
const rawAuthor = current.artist || (typeof current.author === "object" ? current.author?.name : current.author);
|
||||
const progressBar = Utils.progressBar(seekMs, trackDuration, 18, "▬", "▬", "🔘");
|
||||
|
||||
let desc = trackUrl
|
||||
? `**[${Utils.truncate(current.title || this.t(msg, "responses.play.unknownTrack"), 50)}](${trackUrl})**`
|
||||
: `**${Utils.truncate(current.title || this.t(msg, "responses.play.unknownTrack"), 50)}**`;
|
||||
|
||||
if (rawAuthor) {
|
||||
desc += `\n${this.t(msg, "responses.play.byAuthor", { author: rawAuthor })}`;
|
||||
}
|
||||
desc += `\n\n` + "`" + progressBar + "`";
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xe9196c)
|
||||
.setAuthor({ name: `⏩ ${this.t(msg, "responses.seek.seekTitle")}` })
|
||||
.setTitle(this.t(msg, "responses.seek.seekSubtitle", { position: seekStr, duration: totalStr }))
|
||||
.setDescription(desc)
|
||||
.setFooter({ text: this.t(msg, "responses.seek.seeked", { position: seekStr }) });
|
||||
|
||||
if (current.thumbnail) {
|
||||
embed.setThumbnail(current.thumbnail);
|
||||
}
|
||||
|
||||
return msg.reply({ embeds: [embed] });
|
||||
} else {
|
||||
return msg.reply({ embeds: [new EmbedBuilder().setColor(ERROR_COLOR).setDescription(this.t(msg, "responses.seek.notSupported"))] });
|
||||
return msg.reply({ embeds: [new EmbedBuilder().setColor(0xe9196c).setDescription(this.t(msg, "responses.seek.notSupported"))] });
|
||||
}
|
||||
} catch (err) {
|
||||
return msg.reply({ embeds: [new EmbedBuilder().setColor(ERROR_COLOR).setDescription(this.t(msg, "responses.seek.failed", { error: err.message }))] });
|
||||
return msg.reply({ embeds: [new EmbedBuilder().setColor(0xe9196c).setDescription(this.t(msg, "responses.seek.failed", { error: err.message }))] });
|
||||
}
|
||||
}
|
||||
+26
-10
@@ -5,7 +5,6 @@
|
||||
|
||||
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";
|
||||
|
||||
/**
|
||||
@@ -34,29 +33,33 @@ export async function run(message, data) {
|
||||
const p = await this.getPlayer(message, false, false, false);
|
||||
if (!p) return;
|
||||
|
||||
const current = p.queue?.getCurrent();
|
||||
const rawRate = data.get("rate")?.value;
|
||||
const embed = new EmbedBuilder().setColor(getGlobalColor());
|
||||
const prefix = this.handler?.getPrefix?.(message.message?.guildId ?? message.guild?.id) ?? "%";
|
||||
const embed = new EmbedBuilder().setColor(0xe9196c);
|
||||
|
||||
if (rawRate === null || rawRate === undefined || isNaN(Number(rawRate))) {
|
||||
// Reset to 1.0 or show current speed
|
||||
const currentTimescale = p.activeFilterPayload?.timescale;
|
||||
const currentSpeed = currentTimescale?.speed ?? 1.0;
|
||||
if (currentSpeed !== 1.0) {
|
||||
// Reset
|
||||
const existingPayload = { ...(p.activeFilterPayload || {}) };
|
||||
delete existingPayload.timescale;
|
||||
await p.applyFilter(existingPayload, Object.keys(existingPayload).length > 0 ? p.activeFilter : null);
|
||||
embed.setDescription(this.t(message, "responses.speed.reset"));
|
||||
embed.setAuthor({ name: `⏩ ${this.t(message, "responses.speed.speedTitle")}` })
|
||||
.setTitle("1.0× Normal")
|
||||
.setDescription(this.t(message, "responses.speed.reset"))
|
||||
.setFooter({ text: this.t(message, "responses.speed.resetHint", { prefix }) });
|
||||
} else {
|
||||
const prefix = this.handler?.getPrefix?.(message.message?.guildId ?? message.guild?.id) ?? "%";
|
||||
embed.setDescription(this.t(message, "responses.speed.current", { speed: "1.0", prefix }));
|
||||
embed.setAuthor({ name: `⏩ ${this.t(message, "responses.speed.speedTitle")}` })
|
||||
.setTitle("1.0× Normal")
|
||||
.setDescription(this.t(message, "responses.speed.current", { speed: "1.0", prefix }))
|
||||
.setFooter({ text: this.t(message, "responses.speed.resetHint", { prefix }) });
|
||||
}
|
||||
return message.reply({ embeds: [embed] }).catch(() => {});
|
||||
}
|
||||
|
||||
const speed = Utils.clamp(Number(rawRate), 0.5, 2.0);
|
||||
|
||||
// Preserve other active filters if present, update only timescale speed
|
||||
const existingTimescale = p.activeFilterPayload?.timescale || {};
|
||||
const newTimescale = {
|
||||
...existingTimescale,
|
||||
@@ -73,7 +76,7 @@ export async function run(message, data) {
|
||||
const filterMeta = {
|
||||
key: `speed_${speed}`,
|
||||
label: `${speed}× Speed`,
|
||||
emoji: speed > 1 ? "⏩" : "🐢",
|
||||
emoji: speed > 1 ? "⚡" : "🐢",
|
||||
};
|
||||
|
||||
const res = await p.applyFilter(payload, filterMeta);
|
||||
@@ -82,6 +85,19 @@ export async function run(message, data) {
|
||||
return message.reply({ embeds: [embed] }).catch(() => {});
|
||||
}
|
||||
|
||||
embed.setDescription(this.t(message, "responses.speed.set", { emoji: speed > 1 ? "⏩" : "🐢", speed }));
|
||||
let desc = this.t(message, "responses.speed.applied", { speed });
|
||||
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}`;
|
||||
}
|
||||
|
||||
embed.setAuthor({ name: `⏩ ${this.t(message, "responses.speed.speedTitle")}` })
|
||||
.setTitle(this.t(message, "responses.speed.speedMultiplier", { speed }))
|
||||
.setDescription(desc)
|
||||
.setFooter({ text: this.t(message, "responses.speed.resetHint", { prefix }) });
|
||||
|
||||
if (current?.thumbnail) embed.setThumbnail(current.thumbnail);
|
||||
|
||||
message.reply({ embeds: [embed] }).catch(() => {});
|
||||
}
|
||||
+31
-5
@@ -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 thumbnail command. */
|
||||
export const command = new CommandBuilder()
|
||||
@@ -24,12 +24,38 @@ export const command = new CommandBuilder()
|
||||
export async function run(msg) {
|
||||
const p = await this.getPlayer(msg);
|
||||
if (!p) return;
|
||||
const data = await p.getThumbnail();
|
||||
|
||||
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(getGlobalColor())
|
||||
.setDescription(data.msg);
|
||||
if (data.image) embed.setImage(data.image);
|
||||
.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(() => {});
|
||||
}
|
||||
Reference in new issue
Block a user