blob: 0771e114bcb105166c0787bc5fff4ad02d5c0f22 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
import {Message} from 'discord.js';
import {TYPES} from '../types';
import {inject, injectable} from 'inversify';
import PlayerManager from '../managers/player';
import {STATUS} from '../services/player';
import errorMsg from '../utils/error-msg';
import Command from '.';
@injectable()
export default class implements Command {
public name = 'pause';
public aliases = [];
public examples = [
['pause', 'pauses currently playing song']
];
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.status !== STATUS.PLAYING) {
await msg.channel.send(errorMsg('not currently playing'));
return;
}
player.pause();
await msg.channel.send('the stop-and-go light is now red');
}
}
|