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

+13 -42
View File
@@ -2,11 +2,7 @@ const path = require('node:path');
const { SlashCommandBuilder } = require('@discordjs/builders');
const { useQueue } = require('discord-player');
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder } = 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()
@@ -87,14 +83,10 @@ module.exports = {
plays = 'Unavailable';
}
const source =
sourceStringsFormatted.get(currentTrack.raw.source) ??
'Unavailable';
const source = sourceStringsFormatted.get(currentTrack.raw.source) ?? 'Unavailable';
const queueLength = queue.tracks.data.length;
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,
@@ -103,10 +95,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.';
}
@@ -131,9 +120,7 @@ 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(
@@ -147,9 +134,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\`**.`
}`
)
@@ -166,16 +151,12 @@ module.exports = {
},
{
name: '**Audio source**',
value: `**${sourceIcons.get(
currentTrack.raw.source
)} [${source}](${currentTrack.url})**`,
value: `**${sourceIcons.get(currentTrack.raw.source)} [${source}](${currentTrack.url})**`,
inline: true
}
)
.setFooter({
text: queueLength
? `${queueLength} other tracks in the queue...`
: ' '
text: queueLength ? `${queueLength} other tracks in the queue...` : ' '
})
.setThumbnail(queue.currentTrack.thumbnail)
.setColor(embedColors.colorInfo)
@@ -193,10 +174,7 @@ module.exports = {
confirmation.deferUpdate();
if (confirmation.customId === 'nowplaying-skip') {
if (
!queue ||
(queue.tracks.data.length === 0 && !queue.currentTrack)
) {
if (!queue || (queue.tracks.data.length === 0 && !queue.currentTrack)) {
return await interaction.followUp({
embeds: [
new EmbedBuilder()
@@ -224,23 +202,18 @@ module.exports = {
const skippedTrack = queue.currentTrack;
let durationFormat =
skippedTrack.raw.duration === 0 ||
skippedTrack.duration === '0:00'
skippedTrack.raw.duration === 0 || skippedTrack.duration === '0:00'
? ''
: `\`${skippedTrack.duration}\``;
queue.node.skip();
const repeatModeUserString = loopModesFormatted.get(
queue.repeatMode
);
const repeatModeUserString = loopModesFormatted.get(queue.repeatMode);
return await interaction.followUp({
embeds: [
new EmbedBuilder()
.setAuthor({
name:
interaction.member.nickname ||
interaction.user.username,
name: interaction.member.nickname || interaction.user.username,
iconURL: interaction.user.avatarURL()
})
.setDescription(
@@ -249,9 +222,7 @@ module.exports = {
queue.repeatMode === 0
? ''
: `\n\n**${
queue.repeatMode === 3
? embedIcons.autoplaying
: embedIcons.looping
queue.repeatMode === 3 ? embedIcons.autoplaying : embedIcons.looping
} Looping**\nLoop mode is set to ${repeatModeUserString}. You can change it with **\`/loop\`**.`
}`
)