aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
authorFederico fuji97 Rapetti <[email protected]>2021-12-27 18:41:26 +0100
committerFederico fuji97 Rapetti <[email protected]>2021-12-27 18:41:26 +0100
commit55d8a2e97b6391e000af59c1e86966edc4e4aa81 (patch)
treefc782e08fbc643a47987a3fe64a397f85b8ac308 /src/commands
parent65e1f975b9653a8baafdf023d6e14bac2856fc19 (diff)
downloadmuse-55d8a2e97b6391e000af59c1e86966edc4e4aa81.tar.xz
muse-55d8a2e97b6391e000af59c1e86966edc4e4aa81.zip
Refactor shuffle command as slash command
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/shuffle.ts22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/commands/shuffle.ts b/src/commands/shuffle.ts
index d50f0b3..f560e41 100644
--- a/src/commands/shuffle.ts
+++ b/src/commands/shuffle.ts
@@ -1,17 +1,16 @@
-import {Message} from 'discord.js';
+import {CommandInteraction} 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 '.';
+import {SlashCommandBuilder} from '@discordjs/builders';
@injectable()
export default class implements Command {
- public name = 'shuffle';
- public aliases = [];
- public examples = [
- ['shuffle', 'shuffles the current queue'],
- ];
+ public readonly slashCommand = new SlashCommandBuilder()
+ .setName('shuffle')
+ .setDescription('shuffles the current queue');
public requiresVC = true;
@@ -21,16 +20,19 @@ export default class implements Command {
this.playerManager = playerManager;
}
- public async execute(msg: Message, _: string []): Promise<void> {
- const player = this.playerManager.get(msg.guild!.id);
+ public async executeFromInteraction(interaction: CommandInteraction): Promise<void> {
+ const player = this.playerManager.get(interaction.guild!.id);
if (player.isQueueEmpty()) {
- await msg.channel.send(errorMsg('not enough songs to shuffle'));
+ await interaction.reply({
+ content: errorMsg('not enough songs to shuffle'),
+ ephemeral: true,
+ });
return;
}
player.shuffle();
- await msg.channel.send('shuffled');
+ await interaction.reply('shuffled');
}
}