Files
fluxer/commands/move.mjs
T
NoLogicAlan 0f2ee99f1e Add seek validation, autoplay system, progress bar & codebase cleanup
- Add seek duration validation — seeks beyond track length are rejected
  with clear error showing max allowed position
- Add autoplay system with Last.fm similar tracks + YouTube search
  fallback — automatically queues similar tracks when queue ends
- Add live progress bar to now playing with elapsed/total time display
- Add robust ffmpeg cleanup to prevent race conditions during
  seek/skip/filter operations
- Add proper queue advancement after seek so bot stays in voice
- Add queueEnd event emission on skip/skipTo for autoplay trigger
- Add _lastPlayedTrack preservation for autoplay recommendations
2026-05-21 02:04:05 +03:00

29 lines
1.1 KiB
JavaScript

import { CommandBuilder } from "../src/CommandHandler.mjs";
export const command = new CommandBuilder()
.setName("move")
.setDescription("Move a track from one position to another in the queue.", "commands.move")
.setCategory("music")
.addAliases("mv", "m")
.addNumberOption(o =>
o.setName("from")
.setDescription("The current position of the track in the queue. You can view the indices with the 'list' command.", "options.move.from")
.setRequired(true)
)
.addNumberOption(o =>
o.setName("to")
.setDescription("The target position to move the track to in the queue.", "options.move.to")
.setRequired(true)
);
export async function run(message, data) {
const p = await this.getPlayer(message, false, false, false);
if (!p) return;
const from = data.get("from")?.value;
const to = data.get("to")?.value;
if (from == null || from < 1) return message.replyEmbed("Source position must be 1 or greater.");
if (to == null || to < 1) return message.replyEmbed("Target position must be 1 or greater.");
const res = p.move(from, to);
message.replyEmbed(res);
}