diff --git a/commands/help.js b/commands/help.js index 727644b..db37bf7 100644 --- a/commands/help.js +++ b/commands/help.js @@ -1,6 +1,7 @@ const { SlashCommandBuilder } = require('@discordjs/builders'); const { useMainPlayer, useQueue } = require('discord-player'); const { EmbedBuilder } = require('discord.js'); +const { embedColors } = require('../config.json'); module.exports = { data: new SlashCommandBuilder() @@ -20,7 +21,7 @@ module.exports = { `\`/queue\` - Show the list of tracks added to the queue.\n` + `\`/volume\` \`[percentage]\` - Show or set the playback volume for tracks.\n` ) - .setColor('#4c73df') + .setColor(embedColors.colorInfo) ] }); } diff --git a/commands/leave.js b/commands/leave.js index f1322bf..a8b93c0 100644 --- a/commands/leave.js +++ b/commands/leave.js @@ -1,6 +1,7 @@ const { SlashCommandBuilder } = require('@discordjs/builders'); const { useMainPlayer, useQueue } = require('discord-player'); const { EmbedBuilder } = require('discord.js'); +const { embedColors } = require('../config.json'); module.exports = { data: new SlashCommandBuilder() @@ -8,6 +9,8 @@ module.exports = { .setDescription( 'Clear the track queue and remove the bot from voice channel.' ), + + // todo, allow command to be executed if bot is only member in voice channel run: async ({ interaction }) => { if (!interaction.member.voice.channel) { return interaction.editReply({ @@ -16,7 +19,7 @@ module.exports = { .setDescription( `**Error**\nYou need to be in a voice channel to use this command.` ) - .setColor('#c70057') + .setColor(embedColors.colorError) ] }); } @@ -30,7 +33,7 @@ module.exports = { .setDescription( `**Error**\nNo tracks are currently playing, and the queue is empty. Use the \`/play\` command to play some music!` ) - .setColor('#c70057') + .setColor(embedColors.colorError) ] }); } @@ -44,7 +47,7 @@ module.exports = { .setDescription( `**Leaving**\nCleared the track queue and left voice channel. To play more music, use the \`/play\` command!` ) - .setColor('#4c73df') + .setColor(embedColors.colorSuccess) ] }); } diff --git a/commands/pause.js b/commands/pause.js index 144204b..3fe65b6 100644 --- a/commands/pause.js +++ b/commands/pause.js @@ -1,6 +1,7 @@ const { SlashCommandBuilder } = require('@discordjs/builders'); const { useMainPlayer, useQueue } = require('discord-player'); const { EmbedBuilder } = require('discord.js'); +const { embedColors } = require('../config.json'); module.exports = { data: new SlashCommandBuilder() @@ -14,7 +15,7 @@ module.exports = { .setDescription( `**Error**\nYou need to be in a voice channel to use this command.` ) - .setColor('#c70057') + .setColor(embedColors.colorError) ] }); } @@ -26,7 +27,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription(`**Error**\nThere are no tracks in the queue.`) - .setColor('#c70057') + .setColor(embedColors.colorError) ] }); } @@ -45,7 +46,7 @@ module.exports = { `**Paused**\n**[${queue.currentTrack.title}](${queue.currentTrack.url})**.` ) .setThumbnail(queue.currentTrack.thumbnail) - .setColor('#4c73df') + .setColor(embedColors.colorSuccess) ] }); } else { @@ -60,7 +61,7 @@ module.exports = { `**Resumed**\n**[${queue.currentTrack.title}](${queue.currentTrack.url})**.` ) .setThumbnail(queue.currentTrack.thumbnail) - .setColor('#4c73df') + .setColor(embedColors.colorSuccess) ] }); } diff --git a/commands/play.js b/commands/play.js index 6a78e41..e387ca8 100644 --- a/commands/play.js +++ b/commands/play.js @@ -1,6 +1,7 @@ const { SlashCommandBuilder } = require('@discordjs/builders'); const { useMainPlayer, useQueue } = require('discord-player'); const { EmbedBuilder } = require('discord.js'); +const { embedColors } = require('../config.json'); module.exports = { data: new SlashCommandBuilder() @@ -20,7 +21,7 @@ module.exports = { .setDescription( `**Error**\nYou need to be in a voice channel to use this command.` ) - .setColor('#c70057') + .setColor(embedColors.colorError) ] }); } @@ -43,6 +44,8 @@ module.exports = { } ); + // TODO: Add a check to see if the queue is empty, and if so, add a message to the embed saying that the track is now playing. + // TODO: YouTube thumbnail not shown? Different url than track.thumbnail? await interaction.editReply({ embeds: [ new EmbedBuilder() @@ -54,7 +57,7 @@ module.exports = { `**Added to queue**\n\`[${track.duration}]\` **[${track.title}](${track.url})**` ) .setThumbnail(track.thumbnail) - .setColor('#4c73df') + .setColor(embedColors.colorSuccess) ] }); } catch (e) { diff --git a/commands/queue.js b/commands/queue.js index dd303bc..ffe8171 100644 --- a/commands/queue.js +++ b/commands/queue.js @@ -1,6 +1,7 @@ const { SlashCommandBuilder } = require('@discordjs/builders'); const { useQueue } = require('discord-player'); const { EmbedBuilder } = require('discord.js'); +const { embedColors } = require('../config.json'); module.exports = { data: new SlashCommandBuilder() @@ -20,7 +21,7 @@ module.exports = { .setDescription( `You need to be in a voice channel to use this command.` ) - .setColor('#c70057') + .setColor(embedColors.colorError) ] }); } @@ -38,7 +39,7 @@ module.exports = { iconURL: interaction.guild.iconURL() }) .setDescription(`**Queue**\n${queueString}`) - .setColor('#4c73df') + .setColor(embedColors.colorInfo) ] }); } @@ -53,7 +54,7 @@ module.exports = { .setDescription( `Invalid page number. There are only a total of \`${totalPages}\` pages of tracks.` ) - .setColor('#c70057') + .setColor(embedColors.colorError) ] }); } @@ -85,7 +86,7 @@ module.exports = { .setFooter({ text: `Page ${page + 1} of ${totalPages}` }) - .setColor('#4c73df') + .setColor(embedColors.colorInfo) ] }); } else { @@ -114,7 +115,7 @@ module.exports = { .setFooter({ text: `Page ${page + 1} of ${totalPages}` }) - .setColor('#4c73df') + .setColor(embedColors.colorInfo) ] }); } diff --git a/commands/skip.js b/commands/skip.js index fbce333..b7c4018 100644 --- a/commands/skip.js +++ b/commands/skip.js @@ -1,6 +1,7 @@ const { SlashCommandBuilder } = require('@discordjs/builders'); const { useQueue } = require('discord-player'); const { EmbedBuilder } = require('discord.js'); +const { embedColors } = require('../config.json'); module.exports = { data: new SlashCommandBuilder() @@ -22,7 +23,7 @@ module.exports = { .setDescription( `**Error**\nYou need to be in a voice channel to use this command.` ) - .setColor('#c70057') + .setColor(embedColors.colorError) ] }); } @@ -34,7 +35,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription(`**Error**\nThere are no tracks in the queue.`) - .setColor('#c70057') + .setColor(embedColors.colorError) ] }); } @@ -49,7 +50,7 @@ module.exports = { .setDescription( `**Error**\nThere are \`${queue.tracks.data.length}\` tracks in the queue. You cannot skip to track number \`${skipToTrack}\`.` ) - .setColor('#c70057') + .setColor(embedColors.colorError) ] }); } else { @@ -67,7 +68,7 @@ module.exports = { `**Skipped**\n**[${skippedTrack.title}](${skippedTrack.url})**.` ) .setThumbnail(skippedTrack.thumbnail) - .setColor('#4c73df') + .setColor(embedColors.colorSuccess) ] }); } @@ -86,7 +87,7 @@ module.exports = { `**Skipped**\n**[${skippedTrack.title}](${skippedTrack.url})**.` ) .setThumbnail(skippedTrack.thumbnail) - .setColor('#4c73df') + .setColor(embedColors.colorSuccess) ] }); } diff --git a/commands/volume.js b/commands/volume.js index 45819fc..84664c8 100644 --- a/commands/volume.js +++ b/commands/volume.js @@ -1,6 +1,7 @@ const { SlashCommandBuilder } = require('@discordjs/builders'); const { useMainPlayer, useQueue } = require('discord-player'); const { EmbedBuilder } = require('discord.js'); +const { embedColors } = require('../config.json'); module.exports = { data: new SlashCommandBuilder() @@ -21,7 +22,7 @@ module.exports = { .setDescription( `**Error**\nYou need to be in a voice channel to use this command.` ) - .setColor('#c70057') + .setColor(embedColors.colorError) ] }); } @@ -35,7 +36,7 @@ module.exports = { .setDescription( `**Error**\nThere are no tracks playing or in the queue.` ) - .setColor('#c70057') + .setColor(embedColors.colorError) ] }); } @@ -49,7 +50,7 @@ module.exports = { .setDescription( `**Volume**\nThe playback volume is currently set at \`${queue.node.volume}%\`.` ) - .setColor('#4c73df') + .setColor(embedColors.colorInfo) ] }); } else if (volume > 100 || volume < 1) { @@ -59,7 +60,7 @@ module.exports = { .setDescription( `**Error**\nYou need to pick a number between \`1\` and \`100\`.` ) - .setColor('#c70057') + .setColor(embedColors.colorError) ] }); } else { @@ -75,7 +76,7 @@ module.exports = { .setDescription( `**Volume changed**\nPlayback volume has been set to \`${volume}%\`.` ) - .setColor('#4c73df') + .setColor(embedColors.colorSuccess) ] }); }