chore: update volume command options and remove duplicate file

- Adjusted the volume command optionsto have a minimum value of 1 and a maximum value of 100.
- Updated the corresponding validation in the execute method.
- Cleaned up unnecessary conditions in the execute method.
- Deleted a duplicate volume.ts file.
- Updated the TypeScript file to reflect these changes.
This commit is contained in:
Aaron Sandoval committed 2024-01-31 13:36:44 -07:00
1 parent 46a81fb474
commit d48503f565
2 files changed
+1 -139

No files matched your search

+1 -26
View File
@@ -13,7 +13,7 @@ class VolumeCommand extends BaseSlashCommandInteraction {
const data = localizeCommand(
new SlashCommandBuilder()
.setName('volume')
.addIntegerOption((option) => option.setName('percentage').setMinValue(0).setMaxValue(100))
.addIntegerOption((option) => option.setName('percentage').setMinValue(1).setMaxValue(100))
);
super(data);
}
@@ -35,8 +35,6 @@ class VolumeCommand extends BaseSlashCommandInteraction {
if (!volume && volume !== 0) {
return await this.handleShowCurrentVolume(queue, logger, interaction, translator);
} else if (volume > 100 || volume < 0) {
return await this.handleInvalidVolumeInput(volume, logger, interaction, translator);
} else {
return await this.handleValidVolumeInput(volume, queue, logger, interaction, translator);
}
@@ -69,29 +67,6 @@ class VolumeCommand extends BaseSlashCommandInteraction {
});
}
private async handleInvalidVolumeInput(
volume: number,
logger: Logger,
interaction: ChatInputCommandInteraction,
translator: TFunction
) {
logger.debug('Volume specified was higher than 100% or lower than 0%.');
logger.debug('Responding with warning embed.');
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setDescription(
translator('commands.volume.invalidVolumeRange', {
icon: this.embedOptions.icons.warning,
wrongVolume: volume
})
)
.setColor(this.embedOptions.colors.warning)
]
});
}
private async handleValidVolumeInput(
volume: number,
queue: GuildQueue,