diff options
| author | João Costa <[email protected]> | 2024-10-28 16:16:27 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-10-28 16:16:27 +0000 |
| commit | ce8edf4145469dbaeced2e68c9a138d0fd76d38f (patch) | |
| tree | ae8da28276249570310ef421d80d2d8793bdfb57 /src/commands | |
| parent | ae40463712875613c7d485264d61a7965df8a57d (diff) | |
| parent | 534d8fafaa7f09f7ba940d044b08e6c48f800c7a (diff) | |
| download | muse-ce8edf4145469dbaeced2e68c9a138d0fd76d38f.tar.xz muse-ce8edf4145469dbaeced2e68c9a138d0fd76d38f.zip | |
Merge branch 'master' into feature/select-dotenv-path
Diffstat (limited to 'src/commands')
| -rw-r--r-- | src/commands/config.ts | 27 | ||||
| -rw-r--r-- | src/commands/favorites.ts | 6 | ||||
| -rw-r--r-- | src/commands/play.ts | 6 | ||||
| -rw-r--r-- | src/commands/queue.ts | 19 |
4 files changed, 54 insertions, 4 deletions
diff --git a/src/commands/config.ts b/src/commands/config.ts index f866e82..91b2578 100644 --- a/src/commands/config.ts +++ b/src/commands/config.ts @@ -57,6 +57,15 @@ export default class implements Command { .setMaxValue(100) .setRequired(true))) .addSubcommand(subcommand => subcommand + .setName('set-default-queue-page-size') + .setDescription('set the default page size of the /queue command') + .addIntegerOption(option => option + .setName('page-size') + .setDescription('page size of the /queue command') + .setMinValue(1) + .setMaxValue(30) + .setRequired(true))) + .addSubcommand(subcommand => subcommand .setName('get') .setDescription('show all settings')); @@ -171,6 +180,23 @@ export default class implements Command { break; } + case 'set-default-queue-page-size': { + const value = interaction.options.getInteger('page-size')!; + + await prisma.setting.update({ + where: { + guildId: interaction.guild!.id, + }, + data: { + defaultQueuePageSize: value, + }, + }); + + await interaction.reply('👍 default queue page size updated'); + + break; + } + case 'get': { const embed = new EmbedBuilder().setTitle('Config'); @@ -185,6 +211,7 @@ export default class implements Command { 'Auto announce next song in queue': config.autoAnnounceNextSong ? 'yes' : 'no', 'Add to queue reponses show for requester only': config.autoAnnounceNextSong ? 'yes' : 'no', 'Default Volume': config.defaultVolume, + 'Default queue page size': config.defaultQueuePageSize, }; let description = ''; diff --git a/src/commands/favorites.ts b/src/commands/favorites.ts index f00c96f..d635826 100644 --- a/src/commands/favorites.ts +++ b/src/commands/favorites.ts @@ -28,7 +28,10 @@ export default class implements Command { .setDescription('shuffle the input if you\'re adding multiple tracks')) .addBooleanOption(option => option .setName('split') - .setDescription('if a track has chapters, split it'))) + .setDescription('if a track has chapters, split it')) + .addBooleanOption(option => option + .setName('skip') + .setDescription('skip the currently playing track'))) .addSubcommand(subcommand => subcommand .setName('list') .setDescription('list all favorites')) @@ -124,6 +127,7 @@ export default class implements Command { shuffleAdditions: interaction.options.getBoolean('shuffle') ?? false, addToFrontOfQueue: interaction.options.getBoolean('immediate') ?? false, shouldSplitChapters: interaction.options.getBoolean('split') ?? false, + skipCurrentTrack: interaction.options.getBoolean('skip') ?? false, }); } diff --git a/src/commands/play.ts b/src/commands/play.ts index 65f28d4..25aef1c 100644 --- a/src/commands/play.ts +++ b/src/commands/play.ts @@ -29,7 +29,10 @@ export default class implements Command { .setDescription('shuffle the input if you\'re adding multiple tracks')) .addBooleanOption(option => option .setName('split') - .setDescription('if a track has chapters, split it')); + .setDescription('if a track has chapters, split it')) + .addBooleanOption(option => option + .setName('skip') + .setDescription('skip the currently playing track')); public requiresVC = true; @@ -52,6 +55,7 @@ export default class implements Command { addToFrontOfQueue: interaction.options.getBoolean('immediate') ?? false, shuffleAdditions: interaction.options.getBoolean('shuffle') ?? false, shouldSplitChapters: interaction.options.getBoolean('split') ?? false, + skipCurrentTrack: interaction.options.getBoolean('skip') ?? false, }); } diff --git a/src/commands/queue.ts b/src/commands/queue.ts index 5196ca9..fd36e43 100644 --- a/src/commands/queue.ts +++ b/src/commands/queue.ts @@ -5,6 +5,7 @@ import {TYPES} from '../types.js'; import PlayerManager from '../managers/player.js'; import Command from './index.js'; import {buildQueueEmbed} from '../utils/build-embed.js'; +import {getGuildSettings} from '../utils/get-guild-settings.js'; @injectable() export default class implements Command { @@ -14,6 +15,12 @@ export default class implements Command { .addIntegerOption(option => option .setName('page') .setDescription('page of queue to show [default: 1]') + .setRequired(false)) + .addIntegerOption(option => option + .setName('page-size') + .setDescription('how many items to display per page [default: 10, max: 30]') + .setMinValue(1) + .setMaxValue(30) .setRequired(false)); private readonly playerManager: PlayerManager; @@ -23,9 +30,17 @@ export default class implements Command { } public async execute(interaction: ChatInputCommandInteraction) { - const player = this.playerManager.get(interaction.guild!.id); + const guildId = interaction.guild!.id; + const player = this.playerManager.get(guildId); + + const pageSizeFromOptions = interaction.options.getInteger('page-size'); + const pageSize = pageSizeFromOptions ?? (await getGuildSettings(guildId)).defaultQueuePageSize; - const embed = buildQueueEmbed(player, interaction.options.getInteger('page') ?? 1); + const embed = buildQueueEmbed( + player, + interaction.options.getInteger('page') ?? 1, + pageSize, + ); await interaction.reply({embeds: [embed]}); } |
