fix: Added eslint and prettier-eslint for formatting and linting

This commit is contained in:
Marius Begby committed 2023-07-13 11:35:39 +02:00
1 parent 78dcc1b2e9
commit d0f1c4103a
19 files changed
+1638 -71

No files matched your search

+5 -5
View File
@@ -1,5 +1,5 @@
const { SlashCommandBuilder } = require('@discordjs/builders');
const { useMainPlayer, useQueue } = require('discord-player');
const { useQueue } = require('discord-player');
const {
EmbedBuilder,
StringSelectMenuBuilder,
@@ -23,7 +23,7 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**Failed**\nYou need to be in a voice channel to use this command.`
'**Failed**\nYou need to be in a voice channel to use this command.'
)
.setColor(embedColors.colorWarning)
]
@@ -37,7 +37,7 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**Failed**\nThere are no tracks in the queue. Add tracks with \`/play\`!`
'**Failed**\nThere are no tracks in the queue. Add tracks with `/play`!'
)
.setColor(embedColors.colorWarning)
]
@@ -85,7 +85,7 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**Toggle filters** (beta)\nToggle or disable audio filters for playback.`
'**Toggle filters** (beta)\nToggle or disable audio filters for playback.'
)
.setColor(embedColors.colorInfo)
],
@@ -130,7 +130,7 @@ module.exports = {
iconURL: interaction.user.avatarURL()
})
.setDescription(
`**Disabled filters**\nDisabled all audio filters.`
'**Disabled filters**\nDisabled all audio filters.'
)
.setColor(embedColors.colorSuccess)
],
+11 -12
View File
@@ -1,5 +1,4 @@
const { SlashCommandBuilder } = require('@discordjs/builders');
const { useMainPlayer, useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js');
const { embedColors } = require('../config.json');
@@ -12,17 +11,17 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**List of commands**\n` +
`\`/help\` - Show this menu.\n` +
`\`/play\` \`query\` - Add a track or playlist to the queue by searching or url.\n` +
`\`/pause\` - Pause or resume the current track.\n` +
`\`/queue\` \`[page]\` - Show the list of tracks added to the queue.\n` +
`\`/nowplaying\` - Show information about the track currently playing.\n` +
`\`/filters\` - Toggle various audio filters during playback.\n` +
`\`/volume\` \`[percentage]\` - Show or set the playback volume for tracks.\n` +
`\`/skip\` \`[trackNumber]\` - Skip the current track.\n` +
`\`/remove\` \`trackNumber\` - Remove a specific track from the queue.\n` +
`\`/leave\` - Remove bot from voice channel and clear the queue.\n`
'**List of commands**\n' +
'`/help` - Show this menu.\n' +
'`/play` `query` - Add a track or playlist to the queue by searching or url.\n' +
'`/pause` - Pause or resume the current track.\n' +
'`/queue` `[page]` - Show the list of tracks added to the queue.\n' +
'`/nowplaying` - Show information about the track currently playing.\n' +
'`/filters` - Toggle various audio filters during playback.\n' +
'`/volume` `[percentage]` - Show or set the playback volume for tracks.\n' +
'`/skip` `[trackNumber]` - Skip the current track.\n' +
'`/remove` `trackNumber` - Remove a specific track from the queue.\n' +
'`/leave` - Remove bot from voice channel and clear the queue.\n'
)
.setColor(embedColors.colorInfo)
]
+4 -4
View File
@@ -1,5 +1,5 @@
const { SlashCommandBuilder } = require('@discordjs/builders');
const { useMainPlayer, useQueue } = require('discord-player');
const { useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js');
const { embedColors } = require('../config.json');
@@ -17,7 +17,7 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**Failed**\nYou need to be in a voice channel to use this command.`
'**Failed**\nYou need to be in a voice channel to use this command.'
)
.setColor(embedColors.colorWarning)
]
@@ -31,7 +31,7 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**Failed**\nNo tracks are currently playing, and the queue is empty. Use the \`/play\` command to play some music!`
'**Failed**\nNo tracks are currently playing, and the queue is empty. Use the `/play` command to play some music!'
)
.setColor(embedColors.colorWarning)
]
@@ -45,7 +45,7 @@ module.exports = {
embeds: [
new EmbedBuilder()
.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(embedColors.colorSuccess)
]
+16 -16
View File
@@ -13,7 +13,7 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**Failed**\nYou need to be in a voice channel to use this command.`
'**Failed**\nYou need to be in a voice channel to use this command.'
)
.setColor(embedColors.colorWarning)
]
@@ -27,7 +27,7 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**Failed**\nThere are no tracks in the queue. Add tracks with \`/play\`!`
'**Failed**\nThere are no tracks in the queue. Add tracks with `/play`!'
)
.setColor(embedColors.colorWarning)
]
@@ -39,29 +39,29 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**Failed**\nThere are no tracks in the queue or currently playing.`
'**Failed**\nThere are no tracks in the queue or currently playing.'
)
.setColor(embedColors.colorWarning)
]
});
}
const sourceStringsFormatted = {
youtube: 'YouTube',
soundcloud: 'SoundCloud',
spotify: 'Spotify',
apple_music: 'Apple Music',
arbitrary: 'Direct source'
};
const sourceStringsFormatted = new Map([
['youtube', 'YouTube'],
['soundcloud', 'SoundCloud'],
['spotify', 'Spotify'],
['apple_music', 'Apple Music'],
['arbitrary', 'Direct source']
]);
const currentTrack = queue.currentTrack;
const author = currentTrack.author ? currentTrack.author : 'Unknown';
let author = currentTrack.author ? currentTrack.author : 'Unknown';
if (author === 'cdn.discordapp.com') {
author = 'Unknown';
}
const plays = currentTrack.views !== 0 ? currentTrack.views : 'Unknown';
const source =
sourceStringsFormatted[currentTrack.raw.source] ?? 'Unknown';
sourceStringsFormatted.get(currentTrack.raw.source) ?? 'Unknown';
const queueLength = queue.tracks.data.length;
const timestamp = queue.node.getTimestamp();
let bar = `\`${
@@ -98,8 +98,8 @@ module.exports = {
})
.setDescription(
(queue.node.isPaused()
? `**Currently Paused**\n`
: `**Now Playing**\n`) +
? '**Currently Paused**\n'
: '**Now Playing**\n') +
(currentTrack
? `**[${currentTrack.title}](${currentTrack.url})**`
: 'None') +
@@ -152,7 +152,7 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**Failed**\nThere are no tracks in the queue and nothing currently playing.`
'**Failed**\nThere are no tracks in the queue and nothing currently playing.'
)
.setColor(embedColors.colorWarning)
],
@@ -165,7 +165,7 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**Failed to skip**\nThis track has already been skipped, or is no longer playing.`
'**Failed to skip**\nThis track has already been skipped, or is no longer playing.'
)
.setColor(embedColors.colorWarning)
],
+4 -4
View File
@@ -1,5 +1,5 @@
const { SlashCommandBuilder } = require('@discordjs/builders');
const { useMainPlayer, useQueue } = require('discord-player');
const { useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js');
const { embedColors } = require('../config.json');
@@ -13,7 +13,7 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**Failed**\nYou need to be in a voice channel to use this command.`
'**Failed**\nYou need to be in a voice channel to use this command.'
)
.setColor(embedColors.colorWarning)
]
@@ -27,7 +27,7 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**Failed**\nThere are no tracks in the queue. Add tracks with \`/play\`!`
'**Failed**\nThere are no tracks in the queue. Add tracks with `/play`!'
)
.setColor(embedColors.colorWarning)
]
@@ -39,7 +39,7 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**Failed**\nThere are no tracks in the queue or currently playing.`
'**Failed**\nThere are no tracks in the queue or currently playing.'
)
.setColor(embedColors.colorWarning)
]
+6 -4
View File
@@ -6,7 +6,9 @@ const { embedColors, playerOptions } = require('../config.json');
module.exports = {
data: new SlashCommandBuilder()
.setName('play')
.setDescription('Add a track or playlist to the queue by searching or url.')
.setDescription(
'Add a track or playlist to the queue by searching or url.'
)
.addStringOption((option) =>
option
.setName('query')
@@ -19,7 +21,7 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**Failed**\nYou need to be in a voice channel to use this command.`
'**Failed**\nYou need to be in a voice channel to use this command.'
)
.setColor(embedColors.colorWarning)
]
@@ -54,7 +56,7 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**Unsupported Source**\nThis audio source is a YouTube live stream, which is currently not a supported format.\n\n_If you think that this is incorrect, please submit a bug report in the bot [support server](https://discord.gg/t6Bm8wPpXB)._`
'**Unsupported Source**\nThis audio source is a YouTube live stream, which is currently not a supported format.\n\n_If you think that this is incorrect, please submit a bug report in the bot [support server](https://discord.gg/t6Bm8wPpXB)._'
)
.setColor(embedColors.colorWarning)
]
@@ -90,7 +92,7 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**Failed**\nFailed to add track to queue. Please try again.`
'**Failed**\nFailed to add track to queue. Please try again.'
)
.setColor(embedColors.colorError)
]
+5 -4
View File
@@ -19,7 +19,7 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**Failed**\nYou need to be in a voice channel to use this command.`
'**Failed**\nYou need to be in a voice channel to use this command.'
)
.setColor(embedColors.colorWarning)
]
@@ -30,7 +30,8 @@ module.exports = {
let queueString = '';
if (!queue) {
queueString = `There are no tracks in the queue. Add tracks with \`/play\`!`;
queueString =
'There are no tracks in the queue. Add tracks with `/play`!';
return await interaction.editReply({
embeds: [
new EmbedBuilder()
@@ -41,7 +42,7 @@ module.exports = {
.setDescription(`**Queue**\n${queueString}`)
.setColor(embedColors.colorInfo)
.setFooter({
text: `Page 1 of 1`
text: 'Page 1 of 1'
})
]
});
@@ -125,7 +126,7 @@ module.exports = {
iconURL: interaction.guild.iconURL()
})
.setDescription(
`**Currently playing**\n` +
'**Currently playing**\n' +
(currentTrack
? `**[${currentTrack.title}](${currentTrack.url})**`
: 'None') +
+3 -3
View File
@@ -1,5 +1,5 @@
const { SlashCommandBuilder } = require('@discordjs/builders');
const { useMainPlayer, useQueue } = require('discord-player');
const { useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js');
const { embedColors } = require('../config.json');
@@ -20,7 +20,7 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**Failed**\nYou need to be in a voice channel to use this command.`
'**Failed**\nYou need to be in a voice channel to use this command.'
)
.setColor(embedColors.colorWarning)
]
@@ -34,7 +34,7 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**Failed**\nThere are no tracks in the queue. Add tracks with \`/play\`!`
'**Failed**\nThere are no tracks in the queue. Add tracks with `/play`!'
)
.setColor(embedColors.colorWarning)
]
+3 -3
View File
@@ -19,7 +19,7 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**Failed**\nYou need to be in a voice channel to use this command.`
'**Failed**\nYou need to be in a voice channel to use this command.'
)
.setColor(embedColors.colorWarning)
]
@@ -33,7 +33,7 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**Failed**\nThere are no tracks in the queue. Add tracks with \`/play\`!`
'**Failed**\nThere are no tracks in the queue. Add tracks with `/play`!'
)
.setColor(embedColors.colorWarning)
]
@@ -83,7 +83,7 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**Failed**\nThere are no tracks in the queue and nothing currently playing.`
'**Failed**\nThere are no tracks in the queue and nothing currently playing.'
)
.setColor(embedColors.colorWarning)
]
+4 -4
View File
@@ -1,5 +1,5 @@
const { SlashCommandBuilder } = require('@discordjs/builders');
const { useMainPlayer, useQueue } = require('discord-player');
const { useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js');
const { embedColors } = require('../config.json');
@@ -20,7 +20,7 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**Failed**\nYou need to be in a voice channel to use this command.`
'**Failed**\nYou need to be in a voice channel to use this command.'
)
.setColor(embedColors.colorWarning)
]
@@ -34,7 +34,7 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**Failed**\nThere are no tracks playing or in the queue. Add tracks with \`/play\`!`
'**Failed**\nThere are no tracks playing or in the queue. Add tracks with `/play`!'
)
.setColor(embedColors.colorWarning)
]
@@ -58,7 +58,7 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**Error**\nYou need to pick a number between \`1\` and \`100\`.`
'**Error**\nYou need to pick a number between `1` and `100`.'
)
.setColor(embedColors.colorError)
]