Now embed colors are defined from config

This commit is contained in:
Marius Begby committed 2023-07-07 00:30:18 +02:00
1 parent 5d986a2e6b
commit e80a28d975
7 files changed
+36 -25

No files matched your search

+2 -1
View File
@@ -1,6 +1,7 @@
const { SlashCommandBuilder } = require('@discordjs/builders'); const { SlashCommandBuilder } = require('@discordjs/builders');
const { useMainPlayer, useQueue } = require('discord-player'); const { useMainPlayer, useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js'); const { EmbedBuilder } = require('discord.js');
const { embedColors } = require('../config.json');
module.exports = { module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
@@ -20,7 +21,7 @@ module.exports = {
`\`/queue\` - Show the list of tracks added to the queue.\n` + `\`/queue\` - Show the list of tracks added to the queue.\n` +
`\`/volume\` \`[percentage]\` - Show or set the playback volume for tracks.\n` `\`/volume\` \`[percentage]\` - Show or set the playback volume for tracks.\n`
) )
.setColor('#4c73df') .setColor(embedColors.colorInfo)
] ]
}); });
} }
+6 -3
View File
@@ -1,6 +1,7 @@
const { SlashCommandBuilder } = require('@discordjs/builders'); const { SlashCommandBuilder } = require('@discordjs/builders');
const { useMainPlayer, useQueue } = require('discord-player'); const { useMainPlayer, useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js'); const { EmbedBuilder } = require('discord.js');
const { embedColors } = require('../config.json');
module.exports = { module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
@@ -8,6 +9,8 @@ module.exports = {
.setDescription( .setDescription(
'Clear the track queue and remove the bot from voice channel.' '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 }) => { run: async ({ interaction }) => {
if (!interaction.member.voice.channel) { if (!interaction.member.voice.channel) {
return interaction.editReply({ return interaction.editReply({
@@ -16,7 +19,7 @@ module.exports = {
.setDescription( .setDescription(
`**Error**\nYou need to be in a voice channel to use this command.` `**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( .setDescription(
`**Error**\nNo tracks are currently playing, and the queue is empty. Use the \`/play\` command to play some music!` `**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( .setDescription(
`**Leaving**\nCleared the track queue and left voice channel. To play more music, use the \`/play\` command!` `**Leaving**\nCleared the track queue and left voice channel. To play more music, use the \`/play\` command!`
) )
.setColor('#4c73df') .setColor(embedColors.colorSuccess)
] ]
}); });
} }
+5 -4
View File
@@ -1,6 +1,7 @@
const { SlashCommandBuilder } = require('@discordjs/builders'); const { SlashCommandBuilder } = require('@discordjs/builders');
const { useMainPlayer, useQueue } = require('discord-player'); const { useMainPlayer, useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js'); const { EmbedBuilder } = require('discord.js');
const { embedColors } = require('../config.json');
module.exports = { module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
@@ -14,7 +15,7 @@ module.exports = {
.setDescription( .setDescription(
`**Error**\nYou need to be in a voice channel to use this command.` `**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: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription(`**Error**\nThere are no tracks in the queue.`) .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})**.` `**Paused**\n**[${queue.currentTrack.title}](${queue.currentTrack.url})**.`
) )
.setThumbnail(queue.currentTrack.thumbnail) .setThumbnail(queue.currentTrack.thumbnail)
.setColor('#4c73df') .setColor(embedColors.colorSuccess)
] ]
}); });
} else { } else {
@@ -60,7 +61,7 @@ module.exports = {
`**Resumed**\n**[${queue.currentTrack.title}](${queue.currentTrack.url})**.` `**Resumed**\n**[${queue.currentTrack.title}](${queue.currentTrack.url})**.`
) )
.setThumbnail(queue.currentTrack.thumbnail) .setThumbnail(queue.currentTrack.thumbnail)
.setColor('#4c73df') .setColor(embedColors.colorSuccess)
] ]
}); });
} }
+5 -2
View File
@@ -1,6 +1,7 @@
const { SlashCommandBuilder } = require('@discordjs/builders'); const { SlashCommandBuilder } = require('@discordjs/builders');
const { useMainPlayer, useQueue } = require('discord-player'); const { useMainPlayer, useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js'); const { EmbedBuilder } = require('discord.js');
const { embedColors } = require('../config.json');
module.exports = { module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
@@ -20,7 +21,7 @@ module.exports = {
.setDescription( .setDescription(
`**Error**\nYou need to be in a voice channel to use this command.` `**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({ await interaction.editReply({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
@@ -54,7 +57,7 @@ module.exports = {
`**Added to queue**\n\`[${track.duration}]\` **[${track.title}](${track.url})**` `**Added to queue**\n\`[${track.duration}]\` **[${track.title}](${track.url})**`
) )
.setThumbnail(track.thumbnail) .setThumbnail(track.thumbnail)
.setColor('#4c73df') .setColor(embedColors.colorSuccess)
] ]
}); });
} catch (e) { } catch (e) {
+6 -5
View File
@@ -1,6 +1,7 @@
const { SlashCommandBuilder } = require('@discordjs/builders'); const { SlashCommandBuilder } = require('@discordjs/builders');
const { useQueue } = require('discord-player'); const { useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js'); const { EmbedBuilder } = require('discord.js');
const { embedColors } = require('../config.json');
module.exports = { module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
@@ -20,7 +21,7 @@ module.exports = {
.setDescription( .setDescription(
`You need to be in a voice channel to use this command.` `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() iconURL: interaction.guild.iconURL()
}) })
.setDescription(`**Queue**\n${queueString}`) .setDescription(`**Queue**\n${queueString}`)
.setColor('#4c73df') .setColor(embedColors.colorInfo)
] ]
}); });
} }
@@ -53,7 +54,7 @@ module.exports = {
.setDescription( .setDescription(
`Invalid page number. There are only a total of \`${totalPages}\` pages of tracks.` `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({ .setFooter({
text: `Page ${page + 1} of ${totalPages}` text: `Page ${page + 1} of ${totalPages}`
}) })
.setColor('#4c73df') .setColor(embedColors.colorInfo)
] ]
}); });
} else { } else {
@@ -114,7 +115,7 @@ module.exports = {
.setFooter({ .setFooter({
text: `Page ${page + 1} of ${totalPages}` text: `Page ${page + 1} of ${totalPages}`
}) })
.setColor('#4c73df') .setColor(embedColors.colorInfo)
] ]
}); });
} }
+6 -5
View File
@@ -1,6 +1,7 @@
const { SlashCommandBuilder } = require('@discordjs/builders'); const { SlashCommandBuilder } = require('@discordjs/builders');
const { useQueue } = require('discord-player'); const { useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js'); const { EmbedBuilder } = require('discord.js');
const { embedColors } = require('../config.json');
module.exports = { module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
@@ -22,7 +23,7 @@ module.exports = {
.setDescription( .setDescription(
`**Error**\nYou need to be in a voice channel to use this command.` `**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: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription(`**Error**\nThere are no tracks in the queue.`) .setDescription(`**Error**\nThere are no tracks in the queue.`)
.setColor('#c70057') .setColor(embedColors.colorError)
] ]
}); });
} }
@@ -49,7 +50,7 @@ module.exports = {
.setDescription( .setDescription(
`**Error**\nThere are \`${queue.tracks.data.length}\` tracks in the queue. You cannot skip to track number \`${skipToTrack}\`.` `**Error**\nThere are \`${queue.tracks.data.length}\` tracks in the queue. You cannot skip to track number \`${skipToTrack}\`.`
) )
.setColor('#c70057') .setColor(embedColors.colorError)
] ]
}); });
} else { } else {
@@ -67,7 +68,7 @@ module.exports = {
`**Skipped**\n**[${skippedTrack.title}](${skippedTrack.url})**.` `**Skipped**\n**[${skippedTrack.title}](${skippedTrack.url})**.`
) )
.setThumbnail(skippedTrack.thumbnail) .setThumbnail(skippedTrack.thumbnail)
.setColor('#4c73df') .setColor(embedColors.colorSuccess)
] ]
}); });
} }
@@ -86,7 +87,7 @@ module.exports = {
`**Skipped**\n**[${skippedTrack.title}](${skippedTrack.url})**.` `**Skipped**\n**[${skippedTrack.title}](${skippedTrack.url})**.`
) )
.setThumbnail(skippedTrack.thumbnail) .setThumbnail(skippedTrack.thumbnail)
.setColor('#4c73df') .setColor(embedColors.colorSuccess)
] ]
}); });
} }
+6 -5
View File
@@ -1,6 +1,7 @@
const { SlashCommandBuilder } = require('@discordjs/builders'); const { SlashCommandBuilder } = require('@discordjs/builders');
const { useMainPlayer, useQueue } = require('discord-player'); const { useMainPlayer, useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js'); const { EmbedBuilder } = require('discord.js');
const { embedColors } = require('../config.json');
module.exports = { module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
@@ -21,7 +22,7 @@ module.exports = {
.setDescription( .setDescription(
`**Error**\nYou need to be in a voice channel to use this command.` `**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( .setDescription(
`**Error**\nThere are no tracks playing or in the queue.` `**Error**\nThere are no tracks playing or in the queue.`
) )
.setColor('#c70057') .setColor(embedColors.colorError)
] ]
}); });
} }
@@ -49,7 +50,7 @@ module.exports = {
.setDescription( .setDescription(
`**Volume**\nThe playback volume is currently set at \`${queue.node.volume}%\`.` `**Volume**\nThe playback volume is currently set at \`${queue.node.volume}%\`.`
) )
.setColor('#4c73df') .setColor(embedColors.colorInfo)
] ]
}); });
} else if (volume > 100 || volume < 1) { } else if (volume > 100 || volume < 1) {
@@ -59,7 +60,7 @@ module.exports = {
.setDescription( .setDescription(
`**Error**\nYou need to pick a number between \`1\` and \`100\`.` `**Error**\nYou need to pick a number between \`1\` and \`100\`.`
) )
.setColor('#c70057') .setColor(embedColors.colorError)
] ]
}); });
} else { } else {
@@ -75,7 +76,7 @@ module.exports = {
.setDescription( .setDescription(
`**Volume changed**\nPlayback volume has been set to \`${volume}%\`.` `**Volume changed**\nPlayback volume has been set to \`${volume}%\`.`
) )
.setColor('#4c73df') .setColor(embedColors.colorSuccess)
] ]
}); });
} }