From 884e1acf7d3982e66f28dc2cd68e74325f704c6c Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Mon, 28 Mar 2022 14:25:23 -0400 Subject: Added more buttons to control command --- commands/control.js | 32 +++++++++++++++++++++++++++++--- commands/help.js | 2 +- 2 files changed, 30 insertions(+), 4 deletions(-) (limited to 'commands') diff --git a/commands/control.js b/commands/control.js index c677f3f..8db425c 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 } from '../AudioBackend.js' +import { audio, player, playAudio } from '../AudioBackend.js' export default { @@ -37,12 +37,38 @@ export default { const controlButtons = new MessageActionRow() .addComponents( + new MessageButton() + .setStyle('SUCCESS') + .setLabel('Play') + .setCustomId('play'), new MessageButton() .setStyle('PRIMARY') - .setLabel('Pause') - .setCustomId('soon') + .setLabel('Pause') //possible toggle button instead + .setCustomId('pause'), + new MessageButton() + .setStyle('SECONDARY') + .setLabel('Skip') + .setCustomId('skip'), + new MessageButton() + .setStyle('DANGER') + .setLabel('Leave') + .setCustomId('leave') ); + const filter = i => i.customId === 'pause' && i.user.id === '242775871059001344'; + + const collector = interaction.channel.createMessageComponentCollector({ filter, time: 15000 }); + + collector.on('collect', async i => { + if (i.customId === 'pause') { + await i.reply({content:'test'}) + } + + if (i.customId === 'skip') { + await i.reply + } + }); + return interaction.reply({embeds:[controlEmbed], components:[controlButtons]}); }, }; \ No newline at end of file diff --git a/commands/help.js b/commands/help.js index f56715c..76bd29b 100644 --- a/commands/help.js +++ b/commands/help.js @@ -30,7 +30,7 @@ export default { async execute(interaction, bot) { const helpEmbed = new MessageEmbed() .setAuthor({name:`${bot.user.username} Help`, iconURL:bot.user.avatarURL()}) - .setDescription(`Currently playing \`${audio}\`.`) + .setDescription(`Currently playing \`${audio}\``) .addField('Public Commands', `/help\n/ping\n/about\n`, true) .addField('Bot Owner Only', `/join\n/control\n/stop\n`, true) .setFooter({text:'© Copyright 2020-2022 Andrew Lee. Licensed with GPL-3.0.'}) -- cgit v1.2.3