mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-05-10 04:01:37 +02:00
Add shuffle command
This commit is contained in:
parent
fb91c8e89c
commit
ad4d49f763
6 changed files with 52 additions and 68 deletions
|
@ -1,4 +1,5 @@
|
|||
import {injectable} from 'inversify';
|
||||
import shuffle from 'array-shuffle';
|
||||
|
||||
export interface QueuedPlaylist {
|
||||
title: string;
|
||||
|
@ -84,6 +85,16 @@ export default class {
|
|||
}
|
||||
}
|
||||
|
||||
shuffle(guildId: string): void {
|
||||
const queue = this.guildQueues.get(guildId);
|
||||
|
||||
if (!queue) {
|
||||
throw new Error('Queue doesn\'t exist yet.');
|
||||
}
|
||||
|
||||
this.guildQueues.set(guildId, [queue[0], ...shuffle(queue.slice(1))]);
|
||||
}
|
||||
|
||||
size(guildId: string): number {
|
||||
return this.get(guildId).length;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue