diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2022-03-29 20:41:38 -0400 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2022-03-29 20:41:38 -0400 |
| commit | fd89e36490da711ba611c1f7c8dda93a3de054f0 (patch) | |
| tree | e8c1114add718665c75bb90e7af90a9f38101815 /commands/control.js | |
| parent | 84b7017c7016aea12339ec4a3ef2ba1bf0fb3872 (diff) | |
| download | DLAP-fd89e36490da711ba611c1f7c8dda93a3de054f0.tar.gz DLAP-fd89e36490da711ba611c1f7c8dda93a3de054f0.tar.bz2 DLAP-fd89e36490da711ba611c1f7c8dda93a3de054f0.zip | |
New command; Every Discord interation is async
Diffstat (limited to 'commands/control.js')
| -rw-r--r-- | commands/control.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/commands/control.js b/commands/control.js index 7f5e9cb..f221898 100644 --- a/commands/control.js +++ b/commands/control.js @@ -21,7 +21,7 @@ import { SlashCommandBuilder } from '@discordjs/builders' import { MessageEmbed, MessageActionRow, MessageButton } from 'discord.js' -import { audio, player, playAudio, destroyAudio, voiceInit, stopBot } from '../AudioBackend.js' +import {audio, player, destroyAudio, voiceInit, stopBot, searchAudio} from '../AudioBackend.js' import config from '../config.json' assert {type: 'json'} export let controlEmbed @@ -60,7 +60,7 @@ export default { new MessageButton() .setStyle('SECONDARY') .setLabel('>>') - .setCustomId('more'), + .setCustomId('next'), ); const controlButtons2 = new MessageActionRow() @@ -68,7 +68,7 @@ export default { new MessageButton() .setStyle('SECONDARY') .setLabel('<<') - .setCustomId('less'), + .setCustomId('back'), new MessageButton() .setStyle('DANGER') .setLabel('Leave') @@ -86,7 +86,7 @@ export default { collector.on('collect', async ctlButton => { if (ctlButton.customId === 'join') { await ctlButton.reply({content:'Joining voice channel', ephemeral:true}) - voiceInit(bot); + await voiceInit(bot); } if (ctlButton.customId === 'play') { await ctlButton.reply({content:'Resuming music', ephemeral:true}) @@ -99,12 +99,12 @@ export default { if (ctlButton.customId === 'skip') { await ctlButton.reply({content:`Skipping \`${audio}\`...`, ephemeral:true}) player.pause(); - playAudio(bot); + await searchAudio(bot); } - if (ctlButton.customId === 'more') { + if (ctlButton.customId === 'next') { await interaction.editReply({ components: [controlButtons2] }); } - if (ctlButton.customId === 'less') { + if (ctlButton.customId === 'back') { await interaction.editReply({ components: [controlButtons] }); } if (ctlButton.customId === 'leave') { @@ -120,6 +120,6 @@ export default { collector.on('end', collected => console.log(`Collected ${collected.size} items`)); - return interaction.reply({embeds:[controlEmbed], components:[controlButtons]}); + return await interaction.reply({embeds:[controlEmbed], components:[controlButtons]}); }, };
\ No newline at end of file |
