Skip to content

Commit

Permalink
Update typescript and biome, formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
hwangsihu committed Sep 11, 2024
1 parent cfc924f commit 638cdb6
Show file tree
Hide file tree
Showing 105 changed files with 7,477 additions and 7,553 deletions.
13 changes: 1 addition & 12 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,12 @@
},
"formatter": {
"enabled": true,
"indentWidth": 4,
"indentWidth": 2,
"indentStyle": "space",
"lineEnding": "crlf",
"lineWidth": 140,
"formatWithErrors": true
},
"json": {
"linter": {
"enabled": true
},
"formatter": {
"enabled": true,
"indentWidth": 2,
"lineEnding": "crlf",
"lineWidth": 80
}
},
"javascript": {
"formatter": {
"quoteStyle": "double",
Expand Down
11 changes: 1 addition & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,7 @@
"type": "git",
"url": "git+https://github.com/appujet/lavamusic.git"
},
"keywords": [
"discord",
"music",
"bot",
"lavalink",
"shoukaku",
"lavamusic",
"typescript",
"prisma"
],
"keywords": ["discord", "music", "bot", "lavalink", "shoukaku", "lavamusic", "typescript", "prisma"],
"author": "appujet",
"license": "GPL-3.0",
"bugs": {
Expand Down
16 changes: 8 additions & 8 deletions scripts/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import { rm } from "node:fs/promises";
import { resolve } from "node:path";

async function clean() {
try {
const path = resolve("dist");
if (existsSync(path)) {
await rm(path, { recursive: true, force: true });
}
} catch (error) {
console.error("Error while cleaning dist folder:", error);
process.exit(1);
try {
const path = resolve("dist");
if (existsSync(path)) {
await rm(path, { recursive: true, force: true });
}
} catch (error) {
console.error("Error while cleaning dist folder:", error);
process.exit(1);
}
}

clean();
18 changes: 9 additions & 9 deletions scripts/restart.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { exec } from "node:child_process";

async function startLavamusic(): Promise<void> {
exec("npm start", (error, stderr) => {
if (error) {
console.error(`Error starting Lavamusic: ${error.message}`);
return;
}
if (stderr) {
console.error(`Error output: ${stderr}`);
}
});
exec("npm start", (error, stderr) => {
if (error) {
console.error(`Error starting Lavamusic: ${error.message}`);
return;
}
if (stderr) {
console.error(`Error output: ${stderr}`);
}
});
}

setTimeout(startLavamusic, 5000);
4 changes: 2 additions & 2 deletions src/LavaClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ 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 },
intents: [Guilds, GuildMessages, MessageContent, GuildVoiceStates, GuildMembers, GuildMessageTyping],
allowedMentions: { parse: ["users", "roles"], repliedUser: false },
};

const client = new Lavamusic(clientOptions);
Expand Down
126 changes: 63 additions & 63 deletions src/commands/config/247.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,71 +2,71 @@ import type { GuildMember } from "discord.js";
import { Command, type Context, type Lavamusic } from "../../structures/index.js";

export default class _247 extends Command {
constructor(client: Lavamusic) {
super(client, {
name: "247",
description: {
content: "cmd.247.description",
examples: ["247"],
usage: "247",
},
category: "config",
aliases: ["stay"],
cooldown: 3,
args: false,
vote: true,
player: {
voice: true,
dj: false,
active: false,
djPerm: null,
},
permissions: {
dev: false,
client: ["SendMessages", "ReadMessageHistory", "ViewChannel", "EmbedLinks"],
user: ["ManageGuild"],
},
slashCommand: true,
options: [],
});
}
constructor(client: Lavamusic) {
super(client, {
name: "247",
description: {
content: "cmd.247.description",
examples: ["247"],
usage: "247",
},
category: "config",
aliases: ["stay"],
cooldown: 3,
args: false,
vote: true,
player: {
voice: true,
dj: false,
active: false,
djPerm: null,
},
permissions: {
dev: false,
client: ["SendMessages", "ReadMessageHistory", "ViewChannel", "EmbedLinks"],
user: ["ManageGuild"],
},
slashCommand: true,
options: [],
});
}

public async run(client: Lavamusic, ctx: Context): Promise<any> {
const embed = this.client.embed();
let player = client.shoukaku.players.get(ctx.guild!.id) as any;
try {
const data = await client.db.get_247(ctx.guild!.id);
const member = ctx.member as GuildMember;
if (!member.voice.channel) {
return await ctx.sendMessage({
embeds: [embed.setDescription(ctx.locale("cmd.247.errors.not_in_voice")).setColor(client.color.red)],
});
}
if (data) {
await client.db.delete_247(ctx.guild!.id);
return await ctx.sendMessage({
embeds: [embed.setDescription(ctx.locale("cmd.247.messages.disabled")).setColor(client.color.red)],
});
}
await client.db.set_247(ctx.guild!.id, ctx.channel.id, member.voice.channel.id);
if (!player) {
player = await client.queue.create(
ctx.guild,
member.voice.channel,
ctx.channel,
client.shoukaku.options.nodeResolver(client.shoukaku.nodes),
);
}
return await ctx.sendMessage({
embeds: [embed.setDescription(ctx.locale("cmd.247.messages.enabled")).setColor(this.client.color.main)],
});
} catch (error) {
console.error("Error in 247 command:", error);
return await ctx.sendMessage({
embeds: [embed.setDescription(ctx.locale("cmd.247.errors.generic")).setColor(client.color.red)],
});
}
public async run(client: Lavamusic, ctx: Context): Promise<any> {
const embed = this.client.embed();
let player = client.shoukaku.players.get(ctx.guild!.id) as any;
try {
const data = await client.db.get_247(ctx.guild!.id);
const member = ctx.member as GuildMember;
if (!member.voice.channel) {
return await ctx.sendMessage({
embeds: [embed.setDescription(ctx.locale("cmd.247.errors.not_in_voice")).setColor(client.color.red)],
});
}
if (data) {
await client.db.delete_247(ctx.guild!.id);
return await ctx.sendMessage({
embeds: [embed.setDescription(ctx.locale("cmd.247.messages.disabled")).setColor(client.color.red)],
});
}
await client.db.set_247(ctx.guild!.id, ctx.channel.id, member.voice.channel.id);
if (!player) {
player = await client.queue.create(
ctx.guild,
member.voice.channel,
ctx.channel,
client.shoukaku.options.nodeResolver(client.shoukaku.nodes),
);
}
return await ctx.sendMessage({
embeds: [embed.setDescription(ctx.locale("cmd.247.messages.enabled")).setColor(this.client.color.main)],
});
} catch (error) {
console.error("Error in 247 command:", error);
return await ctx.sendMessage({
embeds: [embed.setDescription(ctx.locale("cmd.247.errors.generic")).setColor(client.color.red)],
});
}
}
}

/**
Expand Down
Loading

0 comments on commit 638cdb6

Please sign in to comment.