aboutsummaryrefslogtreecommitdiff
path: root/commands
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2022-07-05 23:08:59 -0400
committerAndrew Lee <alee14498@protonmail.com>2022-07-05 23:08:59 -0400
commit1e294d91c3eab7e65936010c8f0c81c4c4f73b96 (patch)
tree26d3310e2df215bdc621e116ad97ed93ab0dab35 /commands
parent7630b6ca8445cc8f6fc5dfb5284ab23b7c26be46 (diff)
downloadDLAP-1e294d91c3eab7e65936010c8f0c81c4c4f73b96.tar.gz
DLAP-1e294d91c3eab7e65936010c8f0c81c4c4f73b96.tar.bz2
DLAP-1e294d91c3eab7e65936010c8f0c81c4c4f73b96.zip
Removed help; Updated all the new commands; Finally removed final control panel code
Diffstat (limited to 'commands')
-rw-r--r--commands/help.js41
-rw-r--r--commands/join.js1
-rw-r--r--commands/pause.js14
-rw-r--r--commands/play.js17
-rw-r--r--commands/skip.js4
-rw-r--r--commands/stop.js1
6 files changed, 24 insertions, 54 deletions
diff --git a/commands/help.js b/commands/help.js
deleted file mode 100644
index ec0283c..0000000
--- a/commands/help.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/**************************************************************************
- *
- * DLAP Bot: A Discord bot that plays local 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 { audio } from '../AudioBackend.js'
-
-export default {
- data: new SlashCommandBuilder()
- .setName('help')
- .setDescription('Displays commands'),
- async execute(interaction, bot) {
- const helpEmbed = new MessageEmbed()
- .setAuthor({name:`${bot.user.username} Help`, iconURL:bot.user.avatarURL()})
- .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'})
- .setColor('#0066ff')
-
- return await interaction.reply({ embeds: [helpEmbed] });
- },
-}; \ No newline at end of file
diff --git a/commands/join.js b/commands/join.js
index 0de2f14..8ede21a 100644
--- a/commands/join.js
+++ b/commands/join.js
@@ -28,7 +28,6 @@ export default {
.setName('join')
.setDescription('Joins voice chat.'),
async execute(interaction, bot) {
- if (![config.botOwner].includes(interaction.user.id)) return await interaction.reply({ content: "You do not have permissions to execute this command.", ephemeral: true });
await interaction.reply({ content: 'Joining voice channel', ephemeral: true })
return await voiceInit(bot);
},
diff --git a/commands/pause.js b/commands/pause.js
index c0edeeb..7615573 100644
--- a/commands/pause.js
+++ b/commands/pause.js
@@ -21,15 +21,19 @@
import { SlashCommandBuilder } from '@discordjs/builders'
import config from '../config.json' assert {type: 'json'}
-
-export let integer;
+import {audioState, isAudioStatePaused, player} from "../AudioBackend.js";
export default {
data: new SlashCommandBuilder()
.setName('pause')
.setDescription('Pauses the player'),
- async execute(interaction, bot) {
- if (![config.botOwner].includes(interaction.user.id)) return await interaction.reply({ content: "You do not have permissions to execute this command.", ephemeral: true });
-
+ async execute(interaction) {
+ if (isAudioStatePaused === false) {
+ audioState();
+ player.pause();
+ return await interaction.reply({content:'Pausing music', ephemeral:true});
+ } else {
+ return await interaction.reply({content:"Music is already paused", ephemeral:true})
+ }
},
}; \ No newline at end of file
diff --git a/commands/play.js b/commands/play.js
index a6d3453..2a5a385 100644
--- a/commands/play.js
+++ b/commands/play.js
@@ -20,7 +20,7 @@
***************************************************************************/
import { SlashCommandBuilder } from '@discordjs/builders'
-import { inputAudio, audio } from '../AudioBackend.js'
+import { isAudioStatePaused, inputAudio, audio, audioState, player } from '../AudioBackend.js'
import config from '../config.json' assert {type: 'json'}
export let integer;
@@ -33,10 +33,19 @@ export default {
option.setName('int')
.setDescription('Input a number for the selection for the audio file.'),
),
+
async execute(interaction, bot) {
- if (![config.botOwner].includes(interaction.user.id)) return await interaction.reply({ content: "You do not have permissions to execute this command.", ephemeral: true });
integer = interaction.options.getInteger('int');
- await inputAudio(bot, integer);
- return await interaction.reply({ content: `Now playing: ${audio}`, ephemeral: true });
+ if (integer) {
+ await inputAudio(bot, integer);
+ return await interaction.reply({ content: `Now playing: ${audio}`, ephemeral: true });
+ }
+ if (isAudioStatePaused === true) {
+ audioState();
+ player.unpause();
+ return await interaction.reply({content:'Resuming music', ephemeral:true});
+ } else {
+ return await interaction.reply({content:"Music is already playing", ephemeral:true})
+ }
},
}; \ No newline at end of file
diff --git a/commands/skip.js b/commands/skip.js
index 4860209..a49b904 100644
--- a/commands/skip.js
+++ b/commands/skip.js
@@ -27,8 +27,8 @@ export default {
.setName('skip')
.setDescription('Skips the track'),
async execute(interaction, bot) {
+ await interaction.reply({content:`Skipping ${audio}`, ephemeral:true});
player.stop();
- await searchAudio(bot, interaction);
- return await interaction.reply({content:`Skipping ${audio}`, ephemeral:true});
+ return await searchAudio(bot, interaction);
},
}; \ No newline at end of file
diff --git a/commands/stop.js b/commands/stop.js
index ced8fe5..b3997e2 100644
--- a/commands/stop.js
+++ b/commands/stop.js
@@ -28,7 +28,6 @@ export default {
.setName('stop')
.setDescription('Powers off the bot'),
async execute(interaction, bot) {
- if (![config.botOwner].includes(interaction.user.id)) return await interaction.reply({ content: "You do not have permissions to execute this command.", ephemeral: true });
await interaction.reply({ content: 'Powering off...', ephemeral: true})
return await stopBot(bot, interaction);
},