aboutsummaryrefslogtreecommitdiff
path: root/commands/control.js
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2022-03-28 17:42:57 -0400
committerAndrew Lee <alee14498@protonmail.com>2022-03-28 17:42:57 -0400
commit0f5a1a252964861e149a0d784a90f0ad74aa09cb (patch)
treee97d965337b3744290b0d05f5313425a53a92f62 /commands/control.js
parent95870931e77a26a8d50ff3630bf387c923e61a2d (diff)
downloadDLAP-0f5a1a252964861e149a0d784a90f0ad74aa09cb.tar.gz
DLAP-0f5a1a252964861e149a0d784a90f0ad74aa09cb.tar.bz2
DLAP-0f5a1a252964861e149a0d784a90f0ad74aa09cb.zip
Merged the join command
Diffstat (limited to 'commands/control.js')
-rw-r--r--commands/control.js40
1 files changed, 37 insertions, 3 deletions
diff --git a/commands/control.js b/commands/control.js
index 50a78e7..4c8c7a6 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 } from '../AudioBackend.js'
+import {audio, player, playAudio, destroyAudio, voiceInit} from '../AudioBackend.js'
export default {
data: new SlashCommandBuilder()
@@ -39,6 +39,10 @@ export default {
.addComponents(
new MessageButton()
.setStyle('SUCCESS')
+ .setLabel('Join')
+ .setCustomId('join'),
+ new MessageButton()
+ .setStyle('SUCCESS')
.setLabel('Play')
.setCustomId('play'),
new MessageButton()
@@ -50,14 +54,30 @@ export default {
.setLabel('Skip')
.setCustomId('skip'),
new MessageButton()
+ .setStyle('SECONDARY')
+ .setLabel('More')
+ .setCustomId('soon'),
+ );
+
+ const controlButtons2 = new MessageActionRow()
+ .addComponents(
+ new MessageButton()
.setStyle('DANGER')
.setLabel('Leave')
- .setCustomId('leave')
- );
+ .setCustomId('leave'),
+ new MessageButton()
+ .setStyle('DANGER')
+ .setLabel('Power Off')
+ .setCustomId('stop')
+ )
const collector = interaction.channel.createMessageComponentCollector();
collector.on('collect', async ctlButton => {
+ if (ctlButton.customId === 'join') {
+ await ctlButton.reply({content:'Joining voice channel', ephemeral:true})
+ voiceInit(bot);
+ }
if (ctlButton.customId === 'play') {
player.unpause();
await ctlButton.reply({content:'Resuming music', ephemeral:true})
@@ -76,6 +96,20 @@ export default {
console.log('Leaving voice channel...');
destroyAudio(interaction);
}
+ if (ctlButton.customId === 'stop') {
+ await ctlButton.reply({content:'Powering off...', ephemeral:true})
+ const statusEmbed = new MessageEmbed()
+ .setAuthor({name:bot.user.username, iconURL:bot.user.avatarURL()})
+ .setDescription(`That\'s all folks! Powering down ${bot.user.username}...`)
+ .setColor('#0066ff')
+ let statusChannel = bot.channels.cache.get(config.statusChannel);
+ if (!statusChannel) return console.error('The status channel does not exist! Skipping.');
+ await statusChannel.send({ embeds: [statusEmbed] });
+ console.log('Powering off...');
+ destroyAudio(interaction);
+ bot.destroy();
+ process.exit(0);
+ }
});
return interaction.reply({embeds:[controlEmbed], components:[controlButtons]});