diff options
Diffstat (limited to 'commands')
| -rw-r--r-- | commands/control.js | 40 | ||||
| -rw-r--r-- | commands/help.js | 2 | ||||
| -rw-r--r-- | commands/join.js | 34 | ||||
| -rw-r--r-- | commands/ping.js | 2 |
4 files changed, 39 insertions, 39 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]}); diff --git a/commands/help.js b/commands/help.js index 76bd29b..ec79628 100644 --- a/commands/help.js +++ b/commands/help.js @@ -26,7 +26,7 @@ import { audio } from '../AudioBackend.js' export default { data: new SlashCommandBuilder() .setName('help') - .setDescription('Lists the commands'), + .setDescription('Displays commands.'), async execute(interaction, bot) { const helpEmbed = new MessageEmbed() .setAuthor({name:`${bot.user.username} Help`, iconURL:bot.user.avatarURL()}) diff --git a/commands/join.js b/commands/join.js deleted file mode 100644 index 2ac15f9..0000000 --- a/commands/join.js +++ /dev/null @@ -1,34 +0,0 @@ -/************************************************************************** - * - * DLMP3 Bot: A Discord bot that plays local MP3 audio tracks. - * (C) Copyright 2022 - * Programmed by Andrew Lee - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - * - ***************************************************************************/ - -import { SlashCommandBuilder } from '@discordjs/builders' -import { voiceInit } from '../AudioBackend.js' -import { bot } from "../bot.js"; - -export default { - data: new SlashCommandBuilder() - .setName('join') - .setDescription('Joins the voice chat'), - async execute(interaction) { - interaction.reply('Joining the voice channel'); - voiceInit(bot); - }, -};
\ No newline at end of file diff --git a/commands/ping.js b/commands/ping.js index b3fccb7..cbf5370 100644 --- a/commands/ping.js +++ b/commands/ping.js @@ -24,7 +24,7 @@ import { SlashCommandBuilder } from '@discordjs/builders' export default { data: new SlashCommandBuilder() .setName('ping') - .setDescription('Replies with Pong!'), + .setDescription('Pong!'), async execute(interaction) { return interaction.reply('Pong!'); }, |
