fix: solve bug using getNumber after changing to addIntegerOption

This commit is contained in:
Marius Begby committed 2023-12-13 02:37:13 +01:00
1 parent 6ca7ce3e4b
commit 4b630e2512
8 files changed
+8 -8

No files matched your search

+1 -1
View File
@@ -122,7 +122,7 @@ abstract class BaseInteraction {
return { text: 'Page 1 of 1 (0 tracks)' }; return { text: 'Page 1 of 1 (0 tracks)' };
} }
const pageIndex: number = (interaction.options.getNumber('page') || 1) - 1; const pageIndex: number = (interaction.options.getInteger('page') || 1) - 1;
const totalPages: number = Math.ceil(queue.tracks.data.length / 10) || 1; const totalPages: number = Math.ceil(queue.tracks.data.length / 10) || 1;
return { return {
text: `Page ${pageIndex + 1} of ${totalPages} (${queue.tracks.data.length} tracks)` text: `Page ${pageIndex + 1} of ${totalPages} (${queue.tracks.data.length} tracks)`
+1 -1
View File
@@ -30,7 +30,7 @@ class BackCommand extends BaseSlashCommandInteraction {
checkQueueCurrentTrack checkQueueCurrentTrack
]); ]);
const backToTrackInput: number = interaction.options.getNumber('position')!; const backToTrackInput: number = interaction.options.getInteger('position')!;
if (backToTrackInput) { if (backToTrackInput) {
return await this.handleBackToTrackPosition(logger, interaction, history, backToTrackInput); return await this.handleBackToTrackPosition(logger, interaction, history, backToTrackInput);
+1 -1
View File
@@ -182,7 +182,7 @@ class HistoryCommand extends BaseSlashCommandInteraction {
} }
private getPageIndex(interaction: ChatInputCommandInteraction): number { private getPageIndex(interaction: ChatInputCommandInteraction): number {
return (interaction.options.getNumber('page') || 1) - 1; return (interaction.options.getInteger('page') || 1) - 1;
} }
private getTotalPages(history: GuildQueueHistory): number { private getTotalPages(history: GuildQueueHistory): number {
+1 -1
View File
@@ -44,7 +44,7 @@ class LoopCommand extends BaseSlashCommandInteraction {
checkQueueExists checkQueueExists
]); ]);
const userInputRepeatMode: QueueRepeatMode = interaction.options.getNumber('mode')!; const userInputRepeatMode: QueueRepeatMode = interaction.options.getInteger('mode')!;
const currentRepeatMode: QueueRepeatMode = queue.repeatMode; const currentRepeatMode: QueueRepeatMode = queue.repeatMode;
if (!userInputRepeatMode && userInputRepeatMode !== 0) { if (!userInputRepeatMode && userInputRepeatMode !== 0) {
+1 -1
View File
@@ -173,7 +173,7 @@ class QueueCommand extends BaseSlashCommandInteraction {
} }
private getPageIndex(interaction: ChatInputCommandInteraction): number { private getPageIndex(interaction: ChatInputCommandInteraction): number {
return (interaction.options.getNumber('page') || 1) - 1; return (interaction.options.getInteger('page') || 1) - 1;
} }
private getTotalPages(queue: GuildQueue): number { private getTotalPages(queue: GuildQueue): number {
+1 -1
View File
@@ -30,7 +30,7 @@ class SkipCommand extends BaseSlashCommandInteraction {
checkQueueCurrentTrack checkQueueCurrentTrack
]); ]);
const trackPositionInput: number = interaction.options.getNumber('position')!; const trackPositionInput: number = interaction.options.getInteger('position')!;
if (trackPositionInput) { if (trackPositionInput) {
return await this.handleSkipToTrackPosition(logger, interaction, queue, trackPositionInput); return await this.handleSkipToTrackPosition(logger, interaction, queue, trackPositionInput);
+1 -1
View File
@@ -33,7 +33,7 @@ class VolumeCommand extends BaseSlashCommandInteraction {
checkQueueExists checkQueueExists
]); ]);
const volume: number = interaction.options.getNumber('percentage')!; const volume: number = interaction.options.getInteger('percentage')!;
if (!volume && volume !== 0) { if (!volume && volume !== 0) {
return await this.handleShowCurrentVolume(queue, logger, interaction); return await this.handleShowCurrentVolume(queue, logger, interaction);
+1 -1
View File
@@ -189,7 +189,7 @@ class ShardsCommand extends BaseSlashCommandInteraction {
} }
private getPageIndex(interaction: ChatInputCommandInteraction): number { private getPageIndex(interaction: ChatInputCommandInteraction): number {
return (interaction.options.getNumber('page') || 1) - 1; return (interaction.options.getInteger('page') || 1) - 1;
} }
private getTotalPages(shardCount: number): number { private getTotalPages(shardCount: number): number {