diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2022-03-28 19:53:00 -0400 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2022-03-28 19:53:00 -0400 |
| commit | 08aae8cd9e5417bd7451b9af2e3190bf9c6a4e43 (patch) | |
| tree | 965f234d6683b726bddc07ce19914e84b335cd44 /commands | |
| parent | 0f5a1a252964861e149a0d784a90f0ad74aa09cb (diff) | |
| download | DLAP-08aae8cd9e5417bd7451b9af2e3190bf9c6a4e43.tar.gz DLAP-08aae8cd9e5417bd7451b9af2e3190bf9c6a4e43.tar.bz2 DLAP-08aae8cd9e5417bd7451b9af2e3190bf9c6a4e43.zip | |
Removed old cmd handler; Brought back join; New cmd
Diffstat (limited to 'commands')
| -rw-r--r-- | commands/about.js | 2 | ||||
| -rw-r--r-- | commands/control.js | 10 | ||||
| -rw-r--r-- | commands/help.js | 2 | ||||
| -rw-r--r-- | commands/join.js | 33 | ||||
| -rw-r--r-- | commands/stop.js | 47 |
5 files changed, 90 insertions, 4 deletions
diff --git a/commands/about.js b/commands/about.js index b7771db..8177d81 100644 --- a/commands/about.js +++ b/commands/about.js @@ -31,6 +31,8 @@ export default { .setAuthor({name:`About ${bot.user.username}`, iconURL:bot.user.avatarURL()}) .addField('Information', 'A Discord bot that plays local MP3 audio tracks.') .addField('Original Creator', 'Andrew Lee (Alee#4277)') + //.addField('Contributors', '[your name] (discord#0000)') + //.addField('Forked by', '[your name] (discord#0000)') .addField('Frameworks', `Discord.JS ${version} + Voice`) .addField('License', 'GNU General Public License v3.0') .setFooter({text:'© Copyright 2020-2022 Andrew Lee. Licensed with GPL-3.0.'}) diff --git a/commands/control.js b/commands/control.js index 4c8c7a6..b3dd0bf 100644 --- a/commands/control.js +++ b/commands/control.js @@ -21,7 +21,9 @@ import { SlashCommandBuilder } from '@discordjs/builders' import { MessageEmbed, MessageActionRow, MessageButton } from 'discord.js' -import {audio, player, playAudio, destroyAudio, voiceInit} from '../AudioBackend.js' +import { audio, player, playAudio, destroyAudio, voiceInit } from '../AudioBackend.js' + +import config from '../config.json' assert {type: 'json'} export default { data: new SlashCommandBuilder() @@ -38,7 +40,7 @@ export default { const controlButtons = new MessageActionRow() .addComponents( new MessageButton() - .setStyle('SUCCESS') + .setStyle('SECONDARY') .setLabel('Join') .setCustomId('join'), new MessageButton() @@ -47,7 +49,7 @@ export default { .setCustomId('play'), new MessageButton() .setStyle('PRIMARY') - .setLabel('Pause') //possible toggle button instead + .setLabel('Pause') //TODO: possibly toggle button instead .setCustomId('pause'), new MessageButton() .setStyle('SECONDARY') @@ -98,6 +100,7 @@ export default { } 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}...`) @@ -105,6 +108,7 @@ export default { 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(); diff --git a/commands/help.js b/commands/help.js index ec79628..b1ba51f 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('Displays 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 new file mode 100644 index 0000000..45f513c --- /dev/null +++ b/commands/join.js @@ -0,0 +1,33 @@ +/************************************************************************** + * + * 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"; + +export default { + data: new SlashCommandBuilder() + .setName('join') + .setDescription('Joins voice chat.'), + async execute(interaction, bot) { + await interaction.reply('Joining voice channel') + voiceInit(bot); + }, +};
\ No newline at end of file diff --git a/commands/stop.js b/commands/stop.js new file mode 100644 index 0000000..3059997 --- /dev/null +++ b/commands/stop.js @@ -0,0 +1,47 @@ +/************************************************************************** + * + * 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 { MessageEmbed } from "discord.js"; +import config from '../config.json' assert {type: 'json'} +import { destroyAudio } from "../AudioBackend.js"; + +export default { + data: new SlashCommandBuilder() + .setName('stop') + .setDescription('Powers off the bot'), + async execute(interaction, bot) { + await interaction.reply('Powering off...') + + 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); + }, +};
\ No newline at end of file |
