mirror of
https://github.com/BluemediaGER/muse.git
synced 2024-11-13 21:35:28 +01:00
/move command now shows the track that was moved and its position (#610)
This commit is contained in:
parent
ce017090e1
commit
bd749d95a9
|
@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
### Changed
|
||||||
|
- `/move` command now shows the track that was moved and its position
|
||||||
|
|
||||||
## [1.8.2] - 2022-03-27
|
## [1.8.2] - 2022-03-27
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
@ -40,8 +40,8 @@ export default class implements Command {
|
||||||
throw new Error('position must be at least 1');
|
throw new Error('position must be at least 1');
|
||||||
}
|
}
|
||||||
|
|
||||||
player.move(from, to);
|
const {title} = player.move(from, to);
|
||||||
|
|
||||||
await interaction.reply('moved');
|
await interaction.reply('moved **' + title + '** to position **' + String(to) + '**');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -379,12 +379,14 @@ export default class {
|
||||||
this.queue = [];
|
this.queue = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
move(from: number, to: number): void {
|
move(from: number, to: number): QueuedSong {
|
||||||
if (from > this.queueSize() || to > this.queueSize()) {
|
if (from > this.queueSize() || to > this.queueSize()) {
|
||||||
throw new Error('Move index is outside the range of the queue.');
|
throw new Error('Move index is outside the range of the queue.');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.queue.splice(this.queuePosition + to, 0, this.queue.splice(this.queuePosition + from, 1)[0]);
|
this.queue.splice(this.queuePosition + to, 0, this.queue.splice(this.queuePosition + from, 1)[0]);
|
||||||
|
|
||||||
|
return this.queue[this.queuePosition + to];
|
||||||
}
|
}
|
||||||
|
|
||||||
private getHashForCache(url: string): string {
|
private getHashForCache(url: string): string {
|
||||||
|
|
Loading…
Reference in a new issue