Skip to content

Commit

Permalink
v4.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasB25 committed Jul 9, 2024
1 parent e3d1550 commit 2ca455a
Show file tree
Hide file tree
Showing 37 changed files with 533 additions and 705 deletions.
2 changes: 1 addition & 1 deletion Lavalink/example.application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ lavalink:
snapshot: false # set to true if you want to use snapshot builds.
- dependency: "com.dunctebot:skybot-lavalink-plugin:1.7.0"
snapshot: false # set to true if you want to use snapshot builds.
- dependency: "dev.lavalink.youtube:youtube-plugin:1.3.0"
- dependency: "dev.lavalink.youtube:youtube-plugin:1.4.0"
snapshot: false # set to true if you want to use snapshot builds.

pluginsDir: './plugins'
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lavamusic",
"version": "4.3.3",
"version": "4.4.3",
"description": "LavaMusic is a music bot for Discord, written in JavaScript using the Discord.js, Typescript, Shoukaku (Lavalink) library.",
"main": "dist/index.js",
"type": "module",
Expand Down Expand Up @@ -45,12 +45,12 @@
"@types/node": "^20.14.10",
"@types/signale": "^1.4.7",
"lint-staged": "^15.2.7",
"prisma": "^5.16.1",
"prisma": "^5.16.2",
"ts-node": "^10.9.2",
"typescript": "^5.5.3"
},
"dependencies": {
"@prisma/client": "^5.16.1",
"@prisma/client": "^5.16.2",
"discord.js": "^14.15.3",
"dotenv": "^16.4.5",
"node-system-stats": "^1.3.0",
Expand Down
5 changes: 2 additions & 3 deletions scripts/clean-no-log.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// clen dist folder using fs
import { existsSync } from "node:fs";
import { rm } from "node:fs/promises";
import { resolve } from "node:path";
Expand All @@ -7,11 +6,11 @@ async function clean() {
try {
const path = resolve("dist");
if (existsSync(path)) {
await rm(path, { recursive: true });
await rm(path, { recursive: true, force: true });
}
} catch (error) {
process.exit(1);
}
}

clean();
clean();
9 changes: 5 additions & 4 deletions scripts/clean.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// clen dist folder using fs
import { existsSync } from "node:fs";
import { rm } from "node:fs/promises";
import { resolve } from "node:path";
Expand All @@ -8,13 +7,15 @@ async function clean() {
try {
const path = resolve("dist");
if (existsSync(path)) {
await rm(path, { recursive: true });
await rm(path, { recursive: true, force: true });
console.log("Dist folder has been cleaned");
} else {
console.log("Dist folder does not exist");
}
} catch (error) {
console.error(error);
console.error("Error while cleaning dist folder:", error);
process.exit(1);
}
}

clean();
clean();
3 changes: 3 additions & 0 deletions src/LavaClient.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { type ClientOptions, GatewayIntentBits } from "discord.js";
import config from "./config.js";
import Lavamusic from "./structures/Lavamusic.js";

const { GuildMembers, MessageContent, GuildVoiceStates, GuildMessages, Guilds, GuildMessageTyping } = GatewayIntentBits;

const clientOptions: ClientOptions = {
intents: [Guilds, GuildMessages, MessageContent, GuildVoiceStates, GuildMembers, GuildMessageTyping],
allowedMentions: { parse: ["users", "roles"], repliedUser: false },
};

const client = new Lavamusic(clientOptions);
client.start(config.token);

Expand Down
2 changes: 1 addition & 1 deletion src/commands/filters/NightCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default class NightCore extends Command {
],
});
} else {
player.player.setTimescale({rate: 1.2});
player.player.setTimescale({ rate: 1.2 });
player.filters.push("nightcore");
ctx.sendMessage({
embeds: [
Expand Down
2 changes: 1 addition & 1 deletion src/commands/filters/Pitch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default class Pitch extends Command {
],
});
}
player.player.setTimescale({pitch: pitch});
player.player.setTimescale({ pitch: pitch });
return await ctx.sendMessage({
embeds: [
{
Expand Down
2 changes: 1 addition & 1 deletion src/commands/filters/Rate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default class Rate extends Command {
],
});
}
player.player.setTimescale({rate: rate});
player.player.setTimescale({ rate: rate });
return await ctx.sendMessage({
embeds: [
{
Expand Down
2 changes: 1 addition & 1 deletion src/commands/filters/Speed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default class Speed extends Command {
],
});
}
player.player.setTimescale({speed});
player.player.setTimescale({ speed });
return await ctx.sendMessage({
embeds: [
{
Expand Down
4 changes: 2 additions & 2 deletions src/commands/filters/lowPass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default class LowPass extends Command {
const player = client.queue.get(ctx.guild.id);
const filterEnabled = player.filters.includes("lowpass");
if (filterEnabled) {
player.player.setLowPass({smoothing: 0});
player.player.setLowPass({ smoothing: 0 });
player.filters = player.filters.filter((filter) => filter !== "lowpass");
ctx.sendMessage({
embeds: [
Expand All @@ -44,7 +44,7 @@ export default class LowPass extends Command {
],
});
} else {
player.player.setLowPass({smoothing: 20});
player.player.setLowPass({ smoothing: 20 });
player.filters.push("lowpass");
ctx.sendMessage({
embeds: [
Expand Down
28 changes: 9 additions & 19 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import dotenv from "dotenv";
import { SearchEngine } from "./types.js";
dotenv.config();

const parseBoolean = (value?: string): boolean => value?.trim().toLowerCase() === "true";

export default {
token: process.env.TOKEN,
prefix: process.env.PREFIX,
Expand All @@ -12,14 +14,14 @@ export default {
yellow: 0xffff00,
main: 0x2f3136,
},
keepAlive: process.env.KEEP_ALIVE ? parseBoolean(process.env.KEEP_ALIVE) : false,
autoNode: process.env.AUTO_NODE ? parseBoolean(process.env.AUTO_NODE) : false,
keepAlive: parseBoolean(process.env.KEEP_ALIVE),
autoNode: parseBoolean(process.env.AUTO_NODE),
searchEngine: process.env.SEARCH_ENGINE || SearchEngine.YouTube,
maxPlaylistSize: process.env.MAX_PLAYLIST_SIZE ? parseInt(process.env.MAX_PLAYLIST_SIZE) : 100,
maxPlaylistSize: parseInt(process.env.MAX_PLAYLIST_SIZE || "100"),
botStatus: process.env.BOT_STATUS || "online",
botActivity: process.env.BOT_ACTIVITY || "Lavamusic",
botActivityType: process.env.BOT_ACTIVITY_TYPE ? parseInt(process.env.BOT_ACTIVITY_TYPE) : 2,
maxQueueSize: process.env.MAX_QUEUE_SIZE ? parseInt(process.env.MAX_QUEUE_SIZE) : 100,
botActivityType: parseInt(process.env.BOT_ACTIVITY_TYPE || "2"),
maxQueueSize: parseInt(process.env.MAX_QUEUE_SIZE || "100"),
owners: process.env.OWNER_IDS ? JSON.parse(process.env.OWNER_IDS) : [],
clientId: process.env.CLIENT_ID,
guildId: process.env.GUILD_ID,
Expand All @@ -34,29 +36,17 @@ export default {
applemusic: "https://i.imgur.com/Wi0oyYm.png",
deezer: "https://i.imgur.com/xyZ43FG.png",
},
production: process.env.PRODUCTION ? parseBoolean(process.env.PRODUCTION) : true,
production: parseBoolean(process.env.PRODUCTION) ?? true,
lavalink: [
{
url: process.env.LAVALINK_URL,
auth: process.env.LAVALINK_AUTH,
name: process.env.LAVALINK_NAME,
secure: process.env.LAVALINK_SECURE ? parseBoolean(process.env.LAVALINK_SECURE) : false,
secure: parseBoolean(process.env.LAVALINK_SECURE),
},
],
};

function parseBoolean(value: string | undefined): boolean {
if (typeof value === "string") {
value = value.trim().toLowerCase();
}
switch (value) {
case "true":
return true;
default:
return false;
}
}

/**
* Project: lavamusic
* Author: Appu
Expand Down
Loading

0 comments on commit 2ca455a

Please sign in to comment.