mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-04-20 05:13:55 +02:00
36 lines
943 B
TypeScript
36 lines
943 B
TypeScript
import {Message} from 'discord.js';
|
|
import {TYPES} from '../types.js';
|
|
import {inject, injectable} from 'inversify';
|
|
import PlayerManager from '../managers/player.js';
|
|
import errorMsg from '../utils/error-msg.js';
|
|
import Command from '.';
|
|
|
|
@injectable()
|
|
export default class implements Command {
|
|
public name = 'shuffle';
|
|
public aliases = [];
|
|
public examples = [
|
|
['shuffle', 'shuffles the current queue'],
|
|
];
|
|
|
|
public requiresVC = true;
|
|
|
|
private readonly playerManager: PlayerManager;
|
|
|
|
constructor(@inject(TYPES.Managers.Player) playerManager: PlayerManager) {
|
|
this.playerManager = playerManager;
|
|
}
|
|
|
|
public async execute(msg: Message, _: string []): Promise<void> {
|
|
const player = this.playerManager.get(msg.guild!.id);
|
|
|
|
if (player.isQueueEmpty()) {
|
|
await msg.channel.send(errorMsg('not enough songs to shuffle'));
|
|
return;
|
|
}
|
|
|
|
player.shuffle();
|
|
|
|
await msg.channel.send('shuffled');
|
|
}
|
|
}
|