aboutsummaryrefslogtreecommitdiff
path: root/commands/stop.js
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2022-03-28 19:53:00 -0400
committerAndrew Lee <alee14498@protonmail.com>2022-03-28 19:53:00 -0400
commit08aae8cd9e5417bd7451b9af2e3190bf9c6a4e43 (patch)
tree965f234d6683b726bddc07ce19914e84b335cd44 /commands/stop.js
parent0f5a1a252964861e149a0d784a90f0ad74aa09cb (diff)
downloadDLAP-08aae8cd9e5417bd7451b9af2e3190bf9c6a4e43.tar.gz
DLAP-08aae8cd9e5417bd7451b9af2e3190bf9c6a4e43.tar.bz2
DLAP-08aae8cd9e5417bd7451b9af2e3190bf9c6a4e43.zip
Removed old cmd handler; Brought back join; New cmd
Diffstat (limited to 'commands/stop.js')
-rw-r--r--commands/stop.js47
1 files changed, 47 insertions, 0 deletions
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