feat!: Updated configuration and moved config location

This commit is contained in:
Marius Begby committed 2023-07-18 13:11:15 +02:00
1 parent 2d0df79dac
commit dd4b56ae67
40 files changed
+468 -482

No files matched your search

+31 -31
View File
@@ -1,8 +1,6 @@
const path = require('node:path');
const { SlashCommandBuilder } = require('@discordjs/builders');
const { embedOptions, playerOptions } = require('../../config');
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder } = require('discord.js');
const { useQueue } = require('discord-player');
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder } = require('discord.js');
const { embedColors, embedIcons, progressBarOptions } = require(path.resolve('./config.json'));
module.exports = {
data: new SlashCommandBuilder()
@@ -15,9 +13,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nYou need to be in a voice channel to use this command.`
`**${embedOptions.icons.warning} Oops!**\nYou need to be in a voice channel to use this command.`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -29,9 +27,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nThere are no tracks in the queue and nothing currently playing. First add some tracks with **\`/play\`**!`
`**${embedOptions.icons.warning} Oops!**\nThere are no tracks in the queue and nothing currently playing. First add some tracks with **\`/play\`**!`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -41,9 +39,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with **\`/play\`**!`
`**${embedOptions.icons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with **\`/play\`**!`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -57,11 +55,11 @@ module.exports = {
]);
const sourceIcons = new Map([
['youtube', embedIcons.sourceYouTube],
['soundcloud', embedIcons.sourceSoundCloud],
['spotify', embedIcons.sourceSpotify],
['apple_music', embedIcons.sourceAppleMusic],
['arbitrary', embedIcons.sourceArbitrary]
['youtube', embedOptions.icons.sourceYouTube],
['soundcloud', embedOptions.icons.sourceSoundCloud],
['spotify', embedOptions.icons.sourceSpotify],
['apple_music', embedOptions.icons.sourceAppleMusic],
['arbitrary', embedOptions.icons.sourceArbitrary]
]);
const currentTrack = queue.currentTrack;
@@ -88,11 +86,11 @@ module.exports = {
const timestamp = queue.node.getTimestamp();
let bar = `**\`${timestamp.current.label}\`** ${queue.node.createProgressBar({
queue: false,
length: progressBarOptions.length ?? 12,
timecodes: progressBarOptions.timecodes ?? false,
indicator: progressBarOptions.indicator ?? '🔘',
leftChar: progressBarOptions.leftChar ?? '▬',
rightChar: progressBarOptions.rightChar ?? '▬'
length: playerOptions.progressBar.length ?? 12,
timecodes: playerOptions.progressBar.timecodes ?? false,
indicator: playerOptions.progressBar.indicator ?? '🔘',
leftChar: playerOptions.progressBar.leftChar ?? '▬',
rightChar: playerOptions.progressBar.rightChar ?? '▬'
})} **\`${timestamp.total.label}\`**`;
if (currentTrack.raw.duration === 0 || currentTrack.duration === '0:00') {
@@ -104,7 +102,7 @@ module.exports = {
.setCustomId('nowplaying-skip')
.setLabel('Skip track')
.setStyle('Secondary')
.setEmoji(embedIcons.nextTrack)
.setEmoji(embedOptions.icons.nextTrack)
);
const loopModesFormatted = new Map([
@@ -126,7 +124,7 @@ module.exports = {
.setDescription(
(queue.node.isPaused()
? '**Currently Paused**\n'
: `**${embedIcons.audioPlaying} Now Playing**\n`) +
: `**${embedOptions.icons.audioPlaying} Now Playing**\n`) +
`**[${currentTrack.title}](${currentTrack.url})**` +
`\nRequested by: <@${currentTrack.requestedBy.id}>` +
`\n ${bar}\n\n` +
@@ -134,7 +132,7 @@ module.exports = {
queue.repeatMode === 0
? ''
: `**${
queue.repeatMode === 3 ? embedIcons.autoplay : embedIcons.loop
queue.repeatMode === 3 ? embedOptions.icons.autoplay : embedOptions.icons.loop
} Looping**\nLoop mode is set to ${loopModeUserString}. You can change it with **\`/loop\`**.`
}`
)
@@ -159,7 +157,7 @@ module.exports = {
text: queueLength ? `${queueLength} other tracks in the queue...` : ' '
})
.setThumbnail(queue.currentTrack.thumbnail)
.setColor(embedColors.colorInfo)
.setColor(embedOptions.colors.info)
],
components: [nowPlayingActionRow]
});
@@ -179,9 +177,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with **\`/play\`**!`
`**${embedOptions.icons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with **\`/play\`**!`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
],
components: []
});
@@ -192,9 +190,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nThis track has already been skipped or is no longer playing.`
`**${embedOptions.icons.warning} Oops!**\nThis track has already been skipped or is no longer playing.`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
],
components: []
});
@@ -217,17 +215,19 @@ module.exports = {
iconURL: interaction.user.avatarURL()
})
.setDescription(
`**${embedIcons.skipped} Skipped track**\n**${durationFormat} [${skippedTrack.title}](${skippedTrack.url})**` +
`**${embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${skippedTrack.title}](${skippedTrack.url})**` +
`${
queue.repeatMode === 0
? ''
: `\n\n**${
queue.repeatMode === 3 ? embedIcons.autoplaying : embedIcons.looping
queue.repeatMode === 3
? embedOptions.icons.autoplaying
: embedOptions.icons.looping
} Looping**\nLoop mode is set to ${repeatModeUserString}. You can change it with **\`/loop\`**.`
}`
)
.setThumbnail(skippedTrack.thumbnail)
.setColor(embedColors.colorSuccess)
.setColor(embedOptions.colors.success)
],
components: []
});