Skip to content

Commit

Permalink
eslint --fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ballaual committed Apr 5, 2023
1 parent f8f652b commit 0fdfd38
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 66 deletions.
52 changes: 26 additions & 26 deletions commands/Bot/help.js
Original file line number Diff line number Diff line change
@@ -1,63 +1,63 @@
const { SlashCommandBuilder } = require("@discordjs/builders");
const fs = require("fs");
const path = require("path");
const { EmbedBuilder } = require("discord.js");
const { SlashCommandBuilder } = require("@discordjs/builders")
const fs = require("fs")
const path = require("path")
const { EmbedBuilder } = require("discord.js")

module.exports = {
data: new SlashCommandBuilder()
.setName("help")
.setDescription("Shows a list with every command available"),
async execute(interaction) {
const commandFolders = fs.readdirSync(path.join(__dirname, "..", "..", "commands")).filter(folder => folder !== "Inactive");
const commands = [];
async execute (interaction) {
const commandFolders = fs.readdirSync(path.join(__dirname, "..", "..", "commands")).filter(folder => folder !== "Inactive")
const commands = []

for (const folder of commandFolders) {
const folderCommands = fs.readdirSync(path.join(__dirname, "..", "..", "commands", folder)).filter(file => file.endsWith(".js"));
const folderCommands = fs.readdirSync(path.join(__dirname, "..", "..", "commands", folder)).filter(file => file.endsWith(".js"))
for (const file of folderCommands) {
try {
const command = require(path.join(__dirname, "..", "..", "commands", folder, file));
const command = require(path.join(__dirname, "..", "..", "commands", folder, file))
if (command.data) {
commands.push(command.data.toJSON());
commands.push(command.data.toJSON())
} else {
console.log(`Command file ${file} in folder ${folder} doesn't have a data property.`);
console.log(`Command file ${file} in folder ${folder} doesn't have a data property.`)
}
} catch (error) {
console.log(`Error loading command file ${file} in folder ${folder}: ${error}`);
console.log(`Error loading command file ${file} in folder ${folder}: ${error}`)
}
}
}

const sortedCommands = commands.sort((a, b) => a.name.localeCompare(b.name));
const numCommands = sortedCommands.length;
let start = 0;
let end = Math.min(start + 10, numCommands);
const sortedCommands = commands.sort((a, b) => a.name.localeCompare(b.name))
const numCommands = sortedCommands.length
let start = 0
let end = Math.min(start + 10, numCommands)

const embed = new EmbedBuilder()
.setColor("#0000ff")
.setTitle(`Available (/) commands (Part ${Math.floor(start/10) + 1} of ${Math.ceil(numCommands/10)})`)
.setTitle(`Available (/) commands (Part ${Math.floor(start / 10) + 1} of ${Math.ceil(numCommands / 10)})`)
.addFields(sortedCommands.slice(start, end).map(command => ({
name: `/${command.name}`,
value: command.description,
inline: false
})));
})))

await interaction.reply({ embeds: [embed] });
start = end;
await interaction.reply({ embeds: [embed] })
start = end

while (start < numCommands) {
end = Math.min(start + 10, numCommands);
end = Math.min(start + 10, numCommands)

const embed = new EmbedBuilder()
.setColor("#0000ff")
.setTitle(`Available (/) commands (Part ${Math.floor(start/10) + 1} of ${Math.ceil(numCommands/10)})`)
.setTitle(`Available (/) commands (Part ${Math.floor(start / 10) + 1} of ${Math.ceil(numCommands / 10)})`)
.addFields(sortedCommands.slice(start, end).map(command => ({
name: `/${command.name}`,
value: command.description,
inline: false
})));
})))

await interaction.followUp({ embeds: [embed] });
start = end;
await interaction.followUp({ embeds: [embed] })
start = end
}
}
};
}
72 changes: 36 additions & 36 deletions commands/Music/queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,41 @@ module.exports = {
.setName("queue")
.setDescription("Displays the current songs in the music queue"),

async execute(interaction) {
const queue = await distube.getQueue(interaction)

if (!queue) {
const queueError = new EmbedBuilder()
.setDescription("There is currently no song in the queue!")
.setColor("#FF0000")

return interaction.reply({ embeds: [queueError], ephemeral: true })
}

const queueItems = queue.songs.map((song, i) => {
return `${i === 0 ? "Playing:" : `${i}.`} ${song.name} - \`${song.formattedDuration}\``
})

const chunkSize = 10 // Number of items to print in each message
const chunkedQueue = []

for (let i = 0; i < queueItems.length; i += chunkSize) {
chunkedQueue.push(queueItems.slice(i, i + chunkSize))
}

for (let i = 0; i < chunkedQueue.length; i++) {
const currentPart = i + 1
const totalParts = chunkedQueue.length
const embed = new EmbedBuilder()
.setTitle(`**Current queue (Part ${currentPart}/${totalParts})**`)
.setDescription(`\n\n${chunkedQueue[i].join("\n")}`)
.setColor("#FFFF00")

if (i === 0) {
await interaction.reply({ embeds: [embed] })
} else {
await interaction.followUp({ embeds: [embed] })
}
async execute (interaction) {
const queue = await distube.getQueue(interaction)

if (!queue) {
const queueError = new EmbedBuilder()
.setDescription("There is currently no song in the queue!")
.setColor("#FF0000")

return interaction.reply({ embeds: [queueError], ephemeral: true })
}

const queueItems = queue.songs.map((song, i) => {
return `${i === 0 ? "Playing:" : `${i}.`} ${song.name} - \`${song.formattedDuration}\``
})

const chunkSize = 10 // Number of items to print in each message
const chunkedQueue = []

for (let i = 0; i < queueItems.length; i += chunkSize) {
chunkedQueue.push(queueItems.slice(i, i + chunkSize))
}

for (let i = 0; i < chunkedQueue.length; i++) {
const currentPart = i + 1
const totalParts = chunkedQueue.length
const embed = new EmbedBuilder()
.setTitle(`**Current queue (Part ${currentPart}/${totalParts})**`)
.setDescription(`\n\n${chunkedQueue[i].join("\n")}`)
.setColor("#FFFF00")

if (i === 0) {
await interaction.reply({ embeds: [embed] })
} else {
await interaction.followUp({ embeds: [embed] })
}
}
}
}
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dicobo",
"version": "1.2.4",
"version": "1.2.5",
"description": "a discordbot written in discord.js v14 using (/) commands",
"main": "app.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "1.2.4",
"version": "1.2.5",
"note": "DO NOT EDIT this file, unless you know what you are doing here!"
}

0 comments on commit 0fdfd38

Please sign in to comment.