mirror of
https://github.com/BluemediaGER/muse.git
synced 2024-11-23 09:15:29 +01:00
Migrate pause command
This commit is contained in:
parent
cbc9aafe78
commit
e965c02358
|
@ -1,4 +1,5 @@
|
||||||
import {Message} from 'discord.js';
|
import {CommandInteraction} from 'discord.js';
|
||||||
|
import {SlashCommandBuilder} from '@discordjs/builders';
|
||||||
import {TYPES} from '../types.js';
|
import {TYPES} from '../types.js';
|
||||||
import {inject, injectable} from 'inversify';
|
import {inject, injectable} from 'inversify';
|
||||||
import PlayerManager from '../managers/player.js';
|
import PlayerManager from '../managers/player.js';
|
||||||
|
@ -8,11 +9,9 @@ import Command from '.';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export default class implements Command {
|
export default class implements Command {
|
||||||
public name = 'pause';
|
public readonly slashCommand = new SlashCommandBuilder()
|
||||||
public aliases = [];
|
.setName('pause')
|
||||||
public examples = [
|
.setDescription('pauses the current song');
|
||||||
['pause', 'pauses currently playing song'],
|
|
||||||
];
|
|
||||||
|
|
||||||
public requiresVC = true;
|
public requiresVC = true;
|
||||||
|
|
||||||
|
@ -22,15 +21,18 @@ export default class implements Command {
|
||||||
this.playerManager = playerManager;
|
this.playerManager = playerManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async execute(msg: Message, _: string []): Promise<void> {
|
public async executeFromInteraction(interaction: CommandInteraction) {
|
||||||
const player = this.playerManager.get(msg.guild!.id);
|
const player = this.playerManager.get(interaction.guild!.id);
|
||||||
|
|
||||||
if (player.status !== STATUS.PLAYING) {
|
if (player.status !== STATUS.PLAYING) {
|
||||||
await msg.channel.send(errorMsg('not currently playing'));
|
await interaction.reply({
|
||||||
|
content: errorMsg('not currently playing'),
|
||||||
|
ephemeral: true,
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.pause();
|
player.pause();
|
||||||
await msg.channel.send('the stop-and-go light is now red');
|
await interaction.reply('the stop-and-go light is now red');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import GetSongs from '../services/get-songs.js';
|
||||||
export default class implements Command {
|
export default class implements Command {
|
||||||
public readonly slashCommand = new SlashCommandBuilder()
|
public readonly slashCommand = new SlashCommandBuilder()
|
||||||
.setName('play')
|
.setName('play')
|
||||||
.setDescription('Play a song or resume playback')
|
.setDescription('play a song or resume playback')
|
||||||
.addStringOption(option => option
|
.addStringOption(option => option
|
||||||
.setName('query')
|
.setName('query')
|
||||||
.setDescription('YouTube URL, Spotify URL, or search query'))
|
.setDescription('YouTube URL, Spotify URL, or search query'))
|
||||||
|
|
Loading…
Reference in a new issue