mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-23 21:52:45 -05:00
- 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)
68 lines
2.4 KiB
JavaScript
68 lines
2.4 KiB
JavaScript
/**
|
|
* @module commands/resume
|
|
* @description Resume paused playback in the current voice channel.
|
|
*/
|
|
|
|
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 resume command.
|
|
*/
|
|
export const command = new CommandBuilder()
|
|
.setName("resume")
|
|
.setDescription("Resume the playback in your voice channel", "commands.resume")
|
|
.setCategory("music");
|
|
|
|
/**
|
|
* Run handler for the resume command.
|
|
* Resumes playback and sends a confirmation embed.
|
|
*
|
|
* @param {object} message - The command message wrapper.
|
|
* @returns {Promise<void>}
|
|
*/
|
|
export async function run(message) {
|
|
const p = await this.getPlayer(message, false, true, false);
|
|
if (!p) return;
|
|
|
|
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(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(() => {});
|
|
}
|