Implement volume control #830 (#994)

Co-authored-by: Max Isom <hi@maxisom.me>
This commit is contained in:
Matt Foxx 2024-03-12 22:25:45 -04:00 committed by GitHub
parent 786e6fd8f5
commit 6baaffb730
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 141 additions and 11 deletions

View file

@ -40,6 +40,15 @@ export default class implements Command {
.setName('value')
.setDescription('whether to announce the next song in the queue automatically')
.setRequired(true)))
.addSubcommand(subcommand => subcommand
.setName('set-default-volume')
.setDescription('set default volume used when entering the voice channel')
.addIntegerOption(option => option
.setName('level')
.setDescription('volume percentage (0 is muted, 100 is max & default)')
.setMinValue(0)
.setMaxValue(100)
.setRequired(true)))
.addSubcommand(subcommand => subcommand
.setName('get')
.setDescription('show all settings'));
@ -121,6 +130,23 @@ export default class implements Command {
break;
}
case 'set-default-volume': {
const value = interaction.options.getInteger('level')!;
await prisma.setting.update({
where: {
guildId: interaction.guild!.id,
},
data: {
defaultVolume: value,
},
});
await interaction.reply('👍 volume setting updated');
break;
}
case 'get': {
const embed = new EmbedBuilder().setTitle('Config');
@ -133,6 +159,7 @@ export default class implements Command {
: `${config.secondsToWaitAfterQueueEmpties}s`,
'Leave if there are no listeners': config.leaveIfNoListeners ? 'yes' : 'no',
'Auto announce next song in queue': config.autoAnnounceNextSong ? 'yes' : 'no',
'Default Volume': config.defaultVolume,
};
let description = '';