Skip to content

Commit

Permalink
format and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasB25 committed Jul 30, 2024
1 parent c6ada3d commit 50e23c0
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 74 deletions.
20 changes: 9 additions & 11 deletions process.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{
"apps": [
{
"name": "lavamusic",
"script": "dist/index.js",
"node_args": [
"--enable-source-maps"
],
"restart_delay": 10000
}
]
}
"apps": [
{
"name": "lavamusic",
"script": "dist/index.js",
"node_args": ["--enable-source-maps"],
"restart_delay": 10000
}
]
}
4 changes: 2 additions & 2 deletions scripts/restart.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { exec } from 'node:child_process';
import { exec } from "node:child_process";

function startLavamusic() {
exec('npm start', (error, stdout, stderr) => {
exec("npm start", (error, stdout, stderr) => {
if (error) {
console.error(`Error starting Lavamusic: ${error.message}`);
return;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/config/Language.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default class LanguageCommand extends Command {
name: "language",
description: {
content: "cmd.language.description",
examples: ["language set \`EnglishUS\`", "language reset"],
examples: ["language set `EnglishUS`", "language reset"],
usage: "language",
},
category: "general",
Expand Down
8 changes: 4 additions & 4 deletions src/commands/info/Botinfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ export default class Botinfo extends Command {
const commands = client.commands.size;

const promises = [
client.shard.broadcastEval(client => client.guilds.cache.size),
client.shard.broadcastEval(client => client.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0)),
client.shard.broadcastEval(client => client.channels.cache.size),
client.shard.broadcastEval((client) => client.guilds.cache.size),
client.shard.broadcastEval((client) => client.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0)),
client.shard.broadcastEval((client) => client.channels.cache.size),
];
return Promise.all(promises).then(async (results) => {
const guilds = results[0].reduce((acc, guildCount) => acc + guildCount, 0);
Expand Down Expand Up @@ -89,4 +89,4 @@ export default class Botinfo extends Command {
* This code is the property of Coder and may not be reproduced or
* modified without permission. For more information, contact us at
* https://discord.gg/ns8CTk9J3e
*/
*/
9 changes: 0 additions & 9 deletions src/commands/music/Play.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,18 @@ export default class Play extends Command {
switch (res.loadType) {
case LoadType.ERROR:
ctx.editMessage({
content: "",
embeds: [embed.setColor(this.client.color.red).setDescription(ctx.locale("cmd.play.errors.search_error"))],
});
break;
case LoadType.EMPTY:
ctx.editMessage({
content: "",
embeds: [embed.setColor(this.client.color.red).setDescription(ctx.locale("cmd.play.errors.no_results"))],
});
break;
case LoadType.TRACK: {
const track = player.buildTrack(res.data, ctx.author);
if (player.queue.length > client.config.maxQueueSize)
return await ctx.editMessage({
content: "",
embeds: [
embed
.setColor(this.client.color.red)
Expand All @@ -80,7 +77,6 @@ export default class Play extends Command {
player.queue.push(track);
await player.isPlaying();
ctx.editMessage({
content: "",
embeds: [
embed
.setColor(this.client.color.main)
Expand All @@ -92,7 +88,6 @@ export default class Play extends Command {
case LoadType.PLAYLIST: {
if (res.data.tracks.length > client.config.maxPlaylistSize)
return await ctx.editMessage({
content: "",
embeds: [
embed
.setColor(this.client.color.red)
Expand All @@ -105,7 +100,6 @@ export default class Play extends Command {
const pl = player.buildTrack(track, ctx.author);
if (player.queue.length > client.config.maxQueueSize)
return await ctx.editMessage({
content: "",
embeds: [
embed
.setColor(this.client.color.red)
Expand All @@ -118,7 +112,6 @@ export default class Play extends Command {
}
await player.isPlaying();
ctx.editMessage({
content: "",
embeds: [
embed
.setColor(this.client.color.main)
Expand All @@ -131,7 +124,6 @@ export default class Play extends Command {
const track1 = player.buildTrack(res.data[0], ctx.author);
if (player.queue.length > client.config.maxQueueSize)
return await ctx.editMessage({
content: "",
embeds: [
embed
.setColor(this.client.color.red)
Expand All @@ -141,7 +133,6 @@ export default class Play extends Command {
player.queue.push(track1);
await player.isPlaying();
ctx.editMessage({
content: "",
embeds: [
embed
.setColor(this.client.color.main)
Expand Down
9 changes: 0 additions & 9 deletions src/commands/music/PlayNext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,18 @@ export default class PlayNext extends Command {
switch (res.loadType) {
case LoadType.ERROR:
ctx.editMessage({
content: "",
embeds: [embed.setColor(this.client.color.red).setDescription(ctx.locale("cmd.playnext.errors.search_error"))],
});
break;
case LoadType.EMPTY:
ctx.editMessage({
content: "",
embeds: [embed.setColor(this.client.color.red).setDescription(ctx.locale("cmd.playnext.errors.no_results"))],
});
break;
case LoadType.TRACK: {
const track = player.buildTrack(res.data, ctx.author);
if (player.queue.length > client.config.maxQueueSize)
return await ctx.editMessage({
content: "",
embeds: [
embed
.setColor(this.client.color.red)
Expand All @@ -81,7 +78,6 @@ export default class PlayNext extends Command {
player.queue.splice(0, 0, track);
await player.isPlaying();
ctx.editMessage({
content: "",
embeds: [
embed
.setColor(this.client.color.main)
Expand All @@ -95,7 +91,6 @@ export default class PlayNext extends Command {
case LoadType.PLAYLIST: {
if (res.data.tracks.length > client.config.maxPlaylistSize)
return await ctx.editMessage({
content: "",
embeds: [
embed
.setColor(this.client.color.red)
Expand All @@ -108,7 +103,6 @@ export default class PlayNext extends Command {
const pl = player.buildTrack(track, ctx.author);
if (player.queue.length > client.config.maxQueueSize)
return await ctx.editMessage({
content: "",
embeds: [
embed
.setColor(this.client.color.red)
Expand All @@ -121,7 +115,6 @@ export default class PlayNext extends Command {
}
await player.isPlaying();
ctx.editMessage({
content: "",
embeds: [
embed
.setColor(this.client.color.main)
Expand All @@ -134,7 +127,6 @@ export default class PlayNext extends Command {
const track1 = player.buildTrack(res.data[0], ctx.author);
if (player.queue.length > client.config.maxQueueSize)
return await ctx.editMessage({
content: "",
embeds: [
embed
.setColor(this.client.color.red)
Expand All @@ -146,7 +138,6 @@ export default class PlayNext extends Command {
player.queue.splice(0, 0, track1);
await player.isPlaying();
ctx.editMessage({
content: "",
embeds: [
embed
.setColor(this.client.color.main)
Expand Down
1 change: 0 additions & 1 deletion src/events/client/InteractionCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
EmbedBuilder,
type GuildMember,
InteractionType,
Locale,
PermissionFlagsBits,
type TextChannel,
} from "discord.js";
Expand Down
6 changes: 4 additions & 2 deletions src/structures/Lavamusic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ export default class Lavamusic extends Client {

// subcommand options localizations
data.options.map((option) => {

if ("options" in option && option.options.length > 0) {
option.options.map((subOption) => {
// subcommand options name and description localizations
Expand All @@ -140,7 +139,10 @@ export default class Lavamusic extends Client {
const [language, name] = localization.name;
const [language2, description] = localization.description;
subOption.name_localizations = { ...subOption.name_localizations, [language]: name };
subOption.description_localizations = { ...subOption.description_localizations, [language2]: description };
subOption.description_localizations = {
...subOption.description_localizations,
[language2]: description,
};
}
// subcommand options description localization
subOption.description = T(Locale.EnglishUS, subOption.description);
Expand Down
69 changes: 34 additions & 35 deletions src/utils/SetupSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async function setupStart(client: Lavamusic, query: string, player: Dispatcher,
case LoadType.ERROR:
await message.channel
.send({
embeds: [embed.setColor(client.color.red).setDescription(T(locale,"player.setupStart.error_searching"))],
embeds: [embed.setColor(client.color.red).setDescription(T(locale, "player.setupStart.error_searching"))],
})
.then((msg) => setTimeout(() => msg.delete(), 5000));
break;
Expand All @@ -62,7 +62,7 @@ async function setupStart(client: Lavamusic, query: string, player: Dispatcher,
embed
.setColor(client.color.red)
.setDescription(
T(locale,"player.setupStart.queue_too_long", { maxQueueSize: client.config.maxQueueSize }),
T(locale, "player.setupStart.queue_too_long", { maxQueueSize: client.config.maxQueueSize }),
),
],
})
Expand All @@ -74,14 +74,12 @@ async function setupStart(client: Lavamusic, query: string, player: Dispatcher,
await message.channel
.send({
embeds: [
embed
.setColor(client.color.main)
.setDescription(
T(locale,"player.setupStart.added_to_queue", {
title: res.data.info.title,
uri: res.data.info.uri,
}),
),
embed.setColor(client.color.main).setDescription(
T(locale, "player.setupStart.added_to_queue", {
title: res.data.info.title,
uri: res.data.info.uri,
}),
),
],
})
.then((msg) => setTimeout(() => msg.delete(), 5000));
Expand All @@ -94,13 +92,11 @@ async function setupStart(client: Lavamusic, query: string, player: Dispatcher,
await message.channel
.send({
embeds: [
embed
.setColor(client.color.red)
.setDescription(
T(locale,"player.setupStart.playlist_too_long", {
maxPlaylistSize: client.config.maxPlaylistSize,
}),
),
embed.setColor(client.color.red).setDescription(
T(locale, "player.setupStart.playlist_too_long", {
maxPlaylistSize: client.config.maxPlaylistSize,
}),
),
],
})
.then((msg) => setTimeout(() => msg.delete(), 5000));
Expand All @@ -112,13 +108,11 @@ async function setupStart(client: Lavamusic, query: string, player: Dispatcher,
await message.channel
.send({
embeds: [
embed
.setColor(client.color.red)
.setDescription(
T(locale,"player.setupStart.queue_too_long", {
maxQueueSize: client.config.maxQueueSize,
}),
),
embed.setColor(client.color.red).setDescription(
T(locale, "player.setupStart.queue_too_long", {
maxQueueSize: client.config.maxQueueSize,
}),
),
],
})
.then((msg) => setTimeout(() => msg.delete(), 5000));
Expand All @@ -133,7 +127,7 @@ async function setupStart(client: Lavamusic, query: string, player: Dispatcher,
embed
.setColor(client.color.main)
.setDescription(
T(locale,"player.setupStart.added_playlist_to_queue", { length: res.data.tracks.length }),
T(locale, "player.setupStart.added_playlist_to_queue", { length: res.data.tracks.length }),
),
],
})
Expand All @@ -150,7 +144,7 @@ async function setupStart(client: Lavamusic, query: string, player: Dispatcher,
embed
.setColor(client.color.red)
.setDescription(
T(locale,"player.setupStart.queue_too_long", { maxQueueSize: client.config.maxQueueSize }),
T(locale, "player.setupStart.queue_too_long", { maxQueueSize: client.config.maxQueueSize }),
),
],
})
Expand All @@ -162,14 +156,12 @@ async function setupStart(client: Lavamusic, query: string, player: Dispatcher,
await message.channel
.send({
embeds: [
embed
.setColor(client.color.main)
.setDescription(
T(locale,"player.setupStart.added_to_queue", {
title: res.data[0].info.title,
uri: res.data[0].info.uri,
}),
),
embed.setColor(client.color.main).setDescription(
T(locale, "player.setupStart.added_to_queue", {
title: res.data[0].info.title,
uri: res.data[0].info.uri,
}),
),
],
})
.then((msg) => setTimeout(() => msg.delete(), 5000));
Expand All @@ -184,7 +176,14 @@ async function setupStart(client: Lavamusic, query: string, player: Dispatcher,
}
}

async function trackStart(msgId: any, channel: TextChannel, player: Dispatcher, track: Song, client: Lavamusic, locale: string): Promise<void> {
async function trackStart(
msgId: any,
channel: TextChannel,
player: Dispatcher,
track: Song,
client: Lavamusic,
locale: string,
): Promise<void> {
const icon = player.current ? player.current.info.artworkUrl : client.config.links.img;
let m: Message;

Expand Down

0 comments on commit 50e23c0

Please sign in to comment.