mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-05-08 11:21:37 +02:00
Add pause/resume
This commit is contained in:
parent
e55acbb718
commit
2875c6ceb8
4 changed files with 123 additions and 26 deletions
29
src/commands/pause.ts
Normal file
29
src/commands/pause.ts
Normal file
|
@ -0,0 +1,29 @@
|
|||
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 Command from '.';
|
||||
|
||||
@injectable()
|
||||
export default class implements Command {
|
||||
public name = 'pause';
|
||||
public description = 'pause currently playing song';
|
||||
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('error: not currently playing');
|
||||
return;
|
||||
}
|
||||
|
||||
player.pause();
|
||||
await msg.channel.send('paused');
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue