Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Commit

Permalink
fix: solve bug using getNumber after changing to addIntegerOption
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusbegby committed Dec 13, 2023
1 parent 6ca7ce3 commit 4b630e2
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/classes/interactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ abstract class BaseInteraction {
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;
return {
text: `Page ${pageIndex + 1} of ${totalPages} (${queue.tracks.data.length} tracks)`
Expand Down
2 changes: 1 addition & 1 deletion src/interactions/commands/player/back.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class BackCommand extends BaseSlashCommandInteraction {
checkQueueCurrentTrack
]);

const backToTrackInput: number = interaction.options.getNumber('position')!;
const backToTrackInput: number = interaction.options.getInteger('position')!;

if (backToTrackInput) {
return await this.handleBackToTrackPosition(logger, interaction, history, backToTrackInput);
Expand Down
2 changes: 1 addition & 1 deletion src/interactions/commands/player/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class HistoryCommand extends BaseSlashCommandInteraction {
}

private getPageIndex(interaction: ChatInputCommandInteraction): number {
return (interaction.options.getNumber('page') || 1) - 1;
return (interaction.options.getInteger('page') || 1) - 1;
}

private getTotalPages(history: GuildQueueHistory): number {
Expand Down
2 changes: 1 addition & 1 deletion src/interactions/commands/player/loop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class LoopCommand extends BaseSlashCommandInteraction {
checkQueueExists
]);

const userInputRepeatMode: QueueRepeatMode = interaction.options.getNumber('mode')!;
const userInputRepeatMode: QueueRepeatMode = interaction.options.getInteger('mode')!;
const currentRepeatMode: QueueRepeatMode = queue.repeatMode;

if (!userInputRepeatMode && userInputRepeatMode !== 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/interactions/commands/player/queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class QueueCommand extends BaseSlashCommandInteraction {
}

private getPageIndex(interaction: ChatInputCommandInteraction): number {
return (interaction.options.getNumber('page') || 1) - 1;
return (interaction.options.getInteger('page') || 1) - 1;
}

private getTotalPages(queue: GuildQueue): number {
Expand Down
2 changes: 1 addition & 1 deletion src/interactions/commands/player/skip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class SkipCommand extends BaseSlashCommandInteraction {
checkQueueCurrentTrack
]);

const trackPositionInput: number = interaction.options.getNumber('position')!;
const trackPositionInput: number = interaction.options.getInteger('position')!;

if (trackPositionInput) {
return await this.handleSkipToTrackPosition(logger, interaction, queue, trackPositionInput);
Expand Down
2 changes: 1 addition & 1 deletion src/interactions/commands/player/volume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class VolumeCommand extends BaseSlashCommandInteraction {
checkQueueExists
]);

const volume: number = interaction.options.getNumber('percentage')!;
const volume: number = interaction.options.getInteger('percentage')!;

if (!volume && volume !== 0) {
return await this.handleShowCurrentVolume(queue, logger, interaction);
Expand Down
2 changes: 1 addition & 1 deletion src/interactions/commands/system/shards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class ShardsCommand extends BaseSlashCommandInteraction {
}

private getPageIndex(interaction: ChatInputCommandInteraction): number {
return (interaction.options.getNumber('page') || 1) - 1;
return (interaction.options.getInteger('page') || 1) - 1;
}

private getTotalPages(shardCount: number): number {
Expand Down

0 comments on commit 4b630e2

Please sign in to comment.