mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 22:15:29 +00:00
fix: changed loop mode option input to number
This commit is contained in:
1 parent
03c1d5d90f
commit
c4bb6eef3f
1 file changed
+9
-9
@@ -4,29 +4,29 @@ import {
|
|||||||
EmbedBuilder,
|
EmbedBuilder,
|
||||||
Message,
|
Message,
|
||||||
SlashCommandBuilder,
|
SlashCommandBuilder,
|
||||||
SlashCommandStringOption
|
SlashCommandNumberOption
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
|
import { Logger } from 'pino';
|
||||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||||
import { checkQueueExists } from '../../../utils/validation/queueValidator';
|
import { checkQueueExists } from '../../../utils/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||||
import { Logger } from 'pino';
|
|
||||||
|
|
||||||
class LoopCommand extends BaseSlashCommandInteraction {
|
class LoopCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
const data = new SlashCommandBuilder()
|
const data = new SlashCommandBuilder()
|
||||||
.setName('loop')
|
.setName('loop')
|
||||||
.setDescription('Toggle looping a track, the whole queue or autoplay.')
|
.setDescription('Toggle looping a track, the whole queue or autoplay.')
|
||||||
.addStringOption(() =>
|
.addNumberOption(() =>
|
||||||
new SlashCommandStringOption()
|
new SlashCommandNumberOption()
|
||||||
.setName('mode')
|
.setName('mode')
|
||||||
.setDescription('Loop mode: Track, queue, autoplay or disabled.')
|
.setDescription('Loop mode: Track, queue, autoplay or disabled.')
|
||||||
.setRequired(false)
|
.setRequired(false)
|
||||||
.addChoices(
|
.addChoices(
|
||||||
{ name: 'Track', value: QueueRepeatMode.TRACK.toString() },
|
{ name: 'Track', value: QueueRepeatMode.TRACK },
|
||||||
{ name: 'Queue', value: QueueRepeatMode.QUEUE.toString() },
|
{ name: 'Queue', value: QueueRepeatMode.QUEUE },
|
||||||
{ name: 'Autoplay', value: QueueRepeatMode.AUTOPLAY.toString() },
|
{ name: 'Autoplay', value: QueueRepeatMode.AUTOPLAY },
|
||||||
{ name: 'Disabled', value: QueueRepeatMode.OFF.toString() }
|
{ name: 'Disabled', value: QueueRepeatMode.OFF }
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
super(data);
|
super(data);
|
||||||
@@ -44,7 +44,7 @@ class LoopCommand extends BaseSlashCommandInteraction {
|
|||||||
checkQueueExists
|
checkQueueExists
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const userInputRepeatMode: QueueRepeatMode = parseInt(interaction.options.getString('mode')!);
|
const userInputRepeatMode: QueueRepeatMode = interaction.options.getNumber('mode')!;
|
||||||
const currentRepeatMode: QueueRepeatMode = queue.repeatMode;
|
const currentRepeatMode: QueueRepeatMode = queue.repeatMode;
|
||||||
|
|
||||||
if (!userInputRepeatMode && userInputRepeatMode !== 0) {
|
if (!userInputRepeatMode && userInputRepeatMode !== 0) {
|
||||||
|
|||||||
Reference in new issue
Block a user