aboutsummaryrefslogtreecommitdiff
path: root/Commands
diff options
context:
space:
mode:
Diffstat (limited to 'Commands')
-rw-r--r--Commands/about.js56
-rw-r--r--Commands/join.js36
-rw-r--r--Commands/leave.js37
-rw-r--r--Commands/list.js63
-rw-r--r--Commands/next.js42
-rw-r--r--Commands/pause.js40
-rw-r--r--Commands/ping.js31
-rw-r--r--Commands/play.js58
-rw-r--r--Commands/previous.js39
-rw-r--r--Commands/reshuffle.js44
-rw-r--r--Commands/shutdown.js35
-rw-r--r--Commands/status.js76
12 files changed, 557 insertions, 0 deletions
diff --git a/Commands/about.js b/Commands/about.js
new file mode 100644
index 0000000..23c750e
--- /dev/null
+++ b/Commands/about.js
@@ -0,0 +1,56 @@
+/**************************************************************************
+ *
+ * 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 { EmbedBuilder, version, ActionRowBuilder, ButtonBuilder, ButtonStyle, SlashCommandBuilder } from 'discord.js';
+// import npmPackage from '../package.json' assert { type:'json' }
+import { readFileSync } from 'node:fs';
+const npmPackage = JSON.parse(readFileSync('./package.json', 'utf-8'));
+
+export default {
+ data: new SlashCommandBuilder()
+ .setName('about')
+ .setDescription('Information about the bot'),
+ async execute(interaction, bot) {
+ const aboutEmbed = new EmbedBuilder()
+ .setAuthor({ name: `About ${bot.user.username}`, iconURL: bot.user.avatarURL() })
+ .addFields(
+ { name: 'Information', value: 'A Discord bot that plays local audio tracks.' },
+ { name: 'Version', value: `DLAP ${npmPackage.version}` },
+ { name: 'Original Creator', value: 'Andrew Lee (Alee#4277)' }, // Do not remove this since I created this :)
+ // { name: 'Contributors', value: '[your name] (discord#0000)' },
+ // { name: 'Forked by', value: '[your name] (discord#0000)' },
+ { name: 'Frameworks', value: `Discord.JS ${version} + Voice` },
+ { name: 'License', value: 'GNU General Public License v3.0' }
+ )
+ .setFooter({ text: '© Copyright 2020-2022 Andrew Lee' })
+ .setColor('#0066ff');
+
+ const srcOrig = new ActionRowBuilder()
+ .addComponents(
+ new ButtonBuilder()
+ .setStyle(ButtonStyle.Link)
+ .setLabel('Original Source Code')
+ .setURL('https://github.com/Alee14/DLAP')
+ );
+
+ return await interaction.reply({ embeds: [aboutEmbed], components: [srcOrig] });
+ }
+};
diff --git a/Commands/join.js b/Commands/join.js
new file mode 100644
index 0000000..739ebba
--- /dev/null
+++ b/Commands/join.js
@@ -0,0 +1,36 @@
+/**************************************************************************
+ *
+ * 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 'discord.js';
+import { voiceInit } from '../AudioBackend/VoiceInitialization.js';
+import { PermissionFlagsBits } from 'discord-api-types/v10';
+
+export default {
+ data: new SlashCommandBuilder()
+ .setName('join')
+ .setDescription('Joins voice chat')
+ .setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
+ async execute(interaction, bot) {
+ if (!interaction.member.voice.channel) return await interaction.reply({ content: 'You need to be in a voice channel to use this command.', ephemeral: true });
+ await interaction.reply({ content: 'Joining voice channel', ephemeral: true });
+ return await voiceInit(bot);
+ }
+};
diff --git a/Commands/leave.js b/Commands/leave.js
new file mode 100644
index 0000000..cea791a
--- /dev/null
+++ b/Commands/leave.js
@@ -0,0 +1,37 @@
+/**************************************************************************
+ *
+ * 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 'discord.js';
+import { destroyAudio } from '../AudioBackend/Shutdown.js';
+import { PermissionFlagsBits } from 'discord-api-types/v10';
+
+export default {
+ data: new SlashCommandBuilder()
+ .setName('leave')
+ .setDescription('Leaves the voice chat')
+ .setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
+ async execute(interaction) {
+ if (!interaction.member.voice.channel) return await interaction.reply({ content: 'You need to be in a voice channel to use this command.', ephemeral: true });
+ console.log('Leaving voice channel...');
+ await destroyAudio(interaction);
+ return await interaction.reply({ content: 'Leaving voice channel', ephemeral: true });
+ }
+};
diff --git a/Commands/list.js b/Commands/list.js
new file mode 100644
index 0000000..176ae61
--- /dev/null
+++ b/Commands/list.js
@@ -0,0 +1,63 @@
+/**************************************************************************
+ *
+ * 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 { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
+import { readdir } from 'node:fs';
+
+const musicFolder = './music';
+
+export default {
+ data: new SlashCommandBuilder()
+ .setName('list')
+ .setDescription('Lists the available audio tracks')
+ .addIntegerOption(option =>
+ option.setName('page')
+ .setDescription('Input a number to change the page of the list')
+ ),
+ async execute(interaction, bot) {
+ const page = interaction.options.getInteger('page') || 1; // If no page is specified, default to page 1
+ readdir(musicFolder, async(err, files) => {
+ if (err) {
+ console.error(err);
+ } else {
+ const trackList = files.map((file, i) => `${i}: ${file}`); // Create an array of track names
+ const pageSize = 10; // Number of tracks per page
+ const numPages = Math.ceil(trackList.length / pageSize); // Total number of pages
+ if (page < 1 || page > numPages) { // Check if the page number is valid
+ return await interaction.reply({ content: `Invalid page number. Please specify a number between 1 and ${numPages}.`, ephemeral: true });
+ }
+ // Split the track list into pages
+ const pages = [];
+ for (let i = 0; i < numPages; i++) {
+ const start = i * pageSize;
+ const end = start + pageSize;
+ pages.push(trackList.slice(start, end));
+ }
+ // Send the specified page with the page number and total number of pages
+ const listEmbed = new EmbedBuilder();
+ listEmbed.setAuthor({ name: `${bot.user.username} List`, iconURL: bot.user.avatarURL() });
+ listEmbed.addFields({ name: `Listing ${trackList.length} audio tracks...`, value: `\`\`\`\n${pages[page - 1].join('\n')}\n\`\`\`` });
+ listEmbed.setFooter({ text: `Page ${page}/${numPages}` });
+ listEmbed.setColor('#0066ff');
+ await interaction.reply({ embeds: [listEmbed] });
+ }
+ });
+ }
+};
diff --git a/Commands/next.js b/Commands/next.js
new file mode 100644
index 0000000..d3240cf
--- /dev/null
+++ b/Commands/next.js
@@ -0,0 +1,42 @@
+/**************************************************************************
+ *
+ * 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 'discord.js';
+import { player } from '../AudioBackend/VoiceInitialization.js';
+import { nextAudio, playerState } from '../AudioBackend/AudioControl.js';
+import { PermissionFlagsBits } from 'discord-api-types/v10';
+
+export default {
+ data: new SlashCommandBuilder()
+ .setName('next')
+ .setDescription('Goes to next music')
+ .setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
+ async execute(interaction, bot) {
+ if (!interaction.member.voice.channel) return await interaction.reply({ content: 'You need to be in a voice channel to use this command.', ephemeral: true });
+ if (playerState === 'Playing' || playerState === 'Paused') {
+ await interaction.reply({ content: 'Playing next music', ephemeral: true });
+ player.stop();
+ return await nextAudio(bot);
+ } else if (playerState === 'Stopped') {
+ return await interaction.reply({ content: 'Cannot play next music. Player is currently stopped...', ephemeral: true });
+ }
+ }
+};
diff --git a/Commands/pause.js b/Commands/pause.js
new file mode 100644
index 0000000..e461a4c
--- /dev/null
+++ b/Commands/pause.js
@@ -0,0 +1,40 @@
+/**************************************************************************
+ *
+ * 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 'discord.js';
+import { toggleAudioState, isAudioStatePaused } from '../AudioBackend/AudioControl.js';
+import { PermissionFlagsBits } from 'discord-api-types/v10';
+
+export default {
+ data: new SlashCommandBuilder()
+ .setName('pause')
+ .setDescription('Pauses music')
+ .setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
+ async execute(interaction) {
+ if (!interaction.member.voice.channel) return await interaction.reply({ content: 'You need to be in a voice channel to use this command.', ephemeral: true });
+ if (!isAudioStatePaused) {
+ toggleAudioState();
+ return await interaction.reply({ content: 'Pausing music', ephemeral: true });
+ } else {
+ return await interaction.reply({ content: 'Music is already paused', ephemeral: true });
+ }
+ }
+};
diff --git a/Commands/ping.js b/Commands/ping.js
new file mode 100644
index 0000000..72ef024
--- /dev/null
+++ b/Commands/ping.js
@@ -0,0 +1,31 @@
+/**************************************************************************
+ *
+ * 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 'discord.js';
+
+export default {
+ data: new SlashCommandBuilder()
+ .setName('ping')
+ .setDescription('Pong!'),
+ async execute(interaction, bot) {
+ return await interaction.reply(`Pong! ${Math.round(bot.ws.ping)}ms`);
+ }
+};
diff --git a/Commands/play.js b/Commands/play.js
new file mode 100644
index 0000000..a0af3f3
--- /dev/null
+++ b/Commands/play.js
@@ -0,0 +1,58 @@
+/**************************************************************************
+ *
+ * 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 'discord.js';
+import { inputAudio } from '../AudioBackend/QueueSystem.js';
+import { files, isAudioStatePaused, toggleAudioState } from '../AudioBackend/AudioControl.js';
+import { audio } from '../AudioBackend/PlayAudio.js';
+import { PermissionFlagsBits } from 'discord-api-types/v10';
+
+export let integer;
+
+export default {
+ data: new SlashCommandBuilder()
+ .setName('play')
+ .setDescription('Resumes music')
+ .addIntegerOption(option =>
+ option.setName('int')
+ .setDescription('Input a number for the selection for the audio file.')
+ )
+ .setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
+
+ async execute(interaction, bot) {
+ if (!interaction.member.voice.channel) return await interaction.reply({ content: 'You need to be in a voice channel to use this command.', ephemeral: true });
+ integer = interaction.options.getInteger('int');
+ if (integer) {
+ if (integer < files.length) {
+ await inputAudio(bot, integer);
+ return await interaction.reply({ content: `Now playing: ${audio}`, ephemeral: true });
+ } else {
+ return await interaction.reply({ content: 'Number is too big, choose a number that\'s less than ' + files.length + '.', ephemeral: true });
+ }
+ }
+ if (isAudioStatePaused) {
+ toggleAudioState();
+ return await interaction.reply({ content: 'Resuming music', ephemeral: true });
+ } else {
+ return await interaction.reply({ content: 'Music is already playing', ephemeral: true });
+ }
+ }
+};
diff --git a/Commands/previous.js b/Commands/previous.js
new file mode 100644
index 0000000..dd79a98
--- /dev/null
+++ b/Commands/previous.js
@@ -0,0 +1,39 @@
+/**************************************************************************
+ *
+ * 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 'discord.js';
+import { playerState, previousAudio } from '../AudioBackend/AudioControl.js';
+import { PermissionFlagsBits } from 'discord-api-types/v10';
+
+export default {
+ data: new SlashCommandBuilder()
+ .setName('previous')
+ .setDescription('Goes to previous music')
+ .setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
+ async execute(interaction, bot) {
+ if (!interaction.member.voice.channel) return await interaction.reply({ content: 'You need to be in a voice channel to use this command.', ephemeral: true });
+ if (playerState === 'Playing' || playerState === 'Paused') {
+ return await previousAudio(bot, interaction);
+ } else if (playerState === 'Stopped') {
+ return await interaction.reply({ content: 'Cannot play next music. Player is currently stopped...', ephemeral: true });
+ }
+ }
+};
diff --git a/Commands/reshuffle.js b/Commands/reshuffle.js
new file mode 100644
index 0000000..f3e70c2
--- /dev/null
+++ b/Commands/reshuffle.js
@@ -0,0 +1,44 @@
+/**************************************************************************
+ *
+ * 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 'discord.js';
+import { shufflePlaylist } from '../AudioBackend/QueueSystem.js';
+import { PermissionFlagsBits } from 'discord-api-types/v10';
+import { readFileSync } from 'node:fs';
+import { audioState } from '../AudioBackend/AudioControl.js';
+// import config from './config.json' assert {type: 'json'}
+const { shuffle } = JSON.parse(readFileSync('./config.json', 'utf-8'));
+
+export default {
+ data: new SlashCommandBuilder()
+ .setName('reshuffle')
+ .setDescription('Reshuffles the playlist')
+ .setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
+ async execute(interaction, bot) {
+ if (!interaction.member.voice.channel) return await interaction.reply({ content: 'You need to be in a voice channel to use this command.', ephemeral: true });
+ async function shuffleDetected(bot) {
+ await interaction.reply({ content: 'Reshuffling the playlist...', ephemeral: true });
+ await audioState(2);
+ await shufflePlaylist(bot);
+ }
+ return (shuffle) ? await shuffleDetected(bot) : await interaction.reply({ content: 'Shuffle mode is disabled, enable it in the configuration file to access this command.', ephemeral: true });
+ }
+};
diff --git a/Commands/shutdown.js b/Commands/shutdown.js
new file mode 100644
index 0000000..d97922c
--- /dev/null
+++ b/Commands/shutdown.js
@@ -0,0 +1,35 @@
+/**************************************************************************
+ *
+ * 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 'discord.js';
+import { stopBot } from '../AudioBackend/Shutdown.js';
+import { PermissionFlagsBits } from 'discord-api-types/v10';
+
+export default {
+ data: new SlashCommandBuilder()
+ .setName('shutdown')
+ .setDescription('Powers off the bot')
+ .setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
+ async execute(interaction, bot) {
+ await interaction.reply({ content: 'Powering off...', ephemeral: true });
+ return await stopBot(bot, interaction);
+ }
+};
diff --git a/Commands/status.js b/Commands/status.js
new file mode 100644
index 0000000..fc1229d
--- /dev/null
+++ b/Commands/status.js
@@ -0,0 +1,76 @@
+/**************************************************************************
+ *
+ * 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 { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
+import { parseFile } from 'music-metadata';
+import { audio, metadataEmpty, duration, audioTitle, currentTrack } from '../AudioBackend/PlayAudio.js';
+import { files, playerState } from '../AudioBackend/AudioControl.js';
+
+export default {
+ data: new SlashCommandBuilder()
+ .setName('status')
+ .setDescription('Checks what audio file is playing currently'),
+ async execute(interaction, bot) {
+ if (!interaction.member.voice.channel) return await interaction.reply({ content: 'You need to be in a voice channel to use this command.', ephemeral: true });
+ let audioID = currentTrack;
+ audioID++;
+
+ let audioName = files[audioID];
+
+ if (audioName === undefined) {
+ audioName = 'Playlist Finished';
+ } else {
+ if (!metadataEmpty) {
+ try {
+ const { common } = await parseFile('music/' + audioName);
+ audioName = common.title;
+ } catch (error) {
+ console.error(error.message);
+ }
+ } else {
+ audioName = audioName.split('.').slice(0, -1).join('.');
+ }
+ }
+
+ const controlEmbed = new EmbedBuilder()
+ .setAuthor({ name: `${bot.user.username} Status`, iconURL: bot.user.avatarURL() })
+ .addFields(
+ { name: 'State', value: playerState },
+ { name: 'Tracks', value: `${audioID}/${files.length}` },
+ { name: 'Duration', value: duration }
+ // { name: 'Session Uptime', value: `` }
+ )
+ .setColor('#0066ff');
+
+ if (metadataEmpty) {
+ controlEmbed.addFields(
+ { name: 'Currently Playing', value: audio },
+ { name: 'Up Next', value: audioName }
+ );
+ } else {
+ controlEmbed.addFields(
+ { name: 'Currently Playing', value: audioTitle },
+ { name: 'Up Next', value: audioName }
+ );
+ }
+ interaction.reply({ embeds: [controlEmbed] });
+ }
+};