fix: Formatting

This commit is contained in:
Marius Begby committed 2023-07-17 12:42:00 +02:00
1 parent 22f4a22c0e
commit 1d520e95bd
13 files changed
+91 -284

No files matched your search

+12 -41
View File
@@ -2,23 +2,14 @@ const path = require('node:path');
const { SlashCommandBuilder } = require('@discordjs/builders');
const { useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js');
const {
embedColors,
embedIcons,
progressBarOptions
} = require(path.resolve('./config.json'));
const { embedColors, embedIcons, progressBarOptions } = require(path.resolve('./config.json'));
module.exports = {
data: new SlashCommandBuilder()
.setName('queue')
.setDescription('Show the list of tracks added to the queue.')
.setDMPermission(false)
.addNumberOption((option) =>
option
.setName('page')
.setDescription('Page number of the queue')
.setMinValue(1)
),
.addNumberOption((option) => option.setName('page').setDescription('Page number of the queue').setMinValue(1)),
run: async ({ interaction }) => {
if (!interaction.member.voice.channel) {
return await interaction.editReply({
@@ -59,9 +50,7 @@ module.exports = {
name: interaction.guild.name,
iconURL: interaction.guild.iconURL()
})
.setDescription(
`**${embedIcons.queue} Tracks in queue**\n${queueString}`
)
.setDescription(`**${embedIcons.queue} Tracks in queue**\n${queueString}`)
.setColor(embedColors.colorInfo)
.setFooter({
text: 'Page 1 of 1'
@@ -93,13 +82,9 @@ module.exports = {
.slice(pageIndex * 10, pageIndex * 10 + 10)
.map((track, index) => {
let durationFormat =
track.raw.duration === 0 || track.duration === '0:00'
? ''
: `\`${track.duration}\``;
track.raw.duration === 0 || track.duration === '0:00' ? '' : `\`${track.duration}\``;
return `**${
pageIndex * 10 + index + 1
}.** **${durationFormat} [${track.title}](${track.url})**`;
return `**${pageIndex * 10 + index + 1}.** **${durationFormat} [${track.title}](${track.url})**`;
})
.join('\n');
}
@@ -119,9 +104,7 @@ module.exports = {
queue.repeatMode === 0
? ''
: `**${
queue.repeatMode === 3
? embedIcons.autoplay
: embedIcons.loop
queue.repeatMode === 3 ? embedIcons.autoplay : embedIcons.loop
} Looping**\nLoop mode is set to ${loopModeUserString}. You can change it with **\`/loop\`**.\n\n`
}`;
@@ -130,14 +113,11 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setAuthor({
name: `Channel: ${queue.channel.name} (${
queue.channel.bitrate / 1000
}kbps)`,
name: `Channel: ${queue.channel.name} (${queue.channel.bitrate / 1000}kbps)`,
iconURL: interaction.guild.iconURL()
})
.setDescription(
`${repeatModeString}` +
`**${embedIcons.queue} Tracks in queue**\n${queueString}`
`${repeatModeString}` + `**${embedIcons.queue} Tracks in queue**\n${queueString}`
)
.setFooter({
text: `Page ${pageIndex + 1} of ${totalPages}`
@@ -147,9 +127,7 @@ module.exports = {
});
} else {
const timestamp = queue.node.getTimestamp();
let bar = `**\`${
timestamp.current.label
}\`** ${queue.node.createProgressBar({
let bar = `**\`${timestamp.current.label}\`** ${queue.node.createProgressBar({
queue: false,
length: progressBarOptions.length ?? 12,
timecodes: progressBarOptions.timecodes ?? false,
@@ -158,10 +136,7 @@ module.exports = {
rightChar: progressBarOptions.rightChar ?? '▬'
})} **\`${timestamp.total.label}\`**`;
if (
currentTrack.raw.duration === 0 ||
currentTrack.duration === '0:00'
) {
if (currentTrack.raw.duration === 0 || currentTrack.duration === '0:00') {
bar = '_No duration available._';
}
@@ -169,16 +144,12 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setAuthor({
name: `Channel: ${queue.channel.name} (${
queue.channel.bitrate / 1000
}kbps)`,
name: `Channel: ${queue.channel.name} (${queue.channel.bitrate / 1000}kbps)`,
iconURL: interaction.guild.iconURL()
})
.setDescription(
`**${embedIcons.audioPlaying} Now playing**\n` +
(currentTrack
? `**[${currentTrack.title}](${currentTrack.url})**`
: 'None') +
(currentTrack ? `**[${currentTrack.title}](${currentTrack.url})**` : 'None') +
`\nRequested by: <@${currentTrack.requestedBy.id}>` +
`\n ${bar}\n\n` +
`${repeatModeString}` +