Skip to content

Commit

Permalink
Merge pull request appujet#611 from hwangsihu/main
Browse files Browse the repository at this point in the history
Update and appujet#610
  • Loading branch information
LucasB25 authored Jul 12, 2024
2 parents 3d31657 + 7a529dd commit 7194d9a
Show file tree
Hide file tree
Showing 27 changed files with 103 additions and 80 deletions.
8 changes: 2 additions & 6 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,7 @@
},
"files": {
"ignoreUnknown": true,
"ignore": [
".vscode",
"node_modules",
"dist"
]
"ignore": [".vscode", "node_modules", "dist"]
},
"json": {
"formatter": {
Expand All @@ -77,4 +73,4 @@
"semicolons": "always"
}
}
}
}
10 changes: 2 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,8 @@
"build": "tsc --project tsconfig.json",
"clean": "node ./scripts/clean.js && npm run build",
"clean:no-log": "node ./scripts/clean-no-log.js && npm run build",
"lint": "biome lint --write ./src",
"format": "biome format --write ./src"
},
"lint-staged": {
"*.ts": [
"biome check --write",
"biome format --write"
]
"lint": "biome lint --fix ./src",
"format": "biome format --fix ./src"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion src/commands/config/Prefix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class Prefix extends Command {
usage: "prefix [set <prefix> | reset]",
},
category: "general",
aliases: ["prefix"],
aliases: ["pf"],
cooldown: 3,
args: true,
player: {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/config/Setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default class Setup extends Command {
usage: "setup",
},
category: "config",
aliases: ["setup"],
aliases: ["set"],
cooldown: 3,
args: true,
player: {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/dev/GuildList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class GuildList extends Command {
usage: "guildlist",
},
category: "dev",
aliases: ["glt"],
aliases: ["glst"],
cooldown: 3,
args: false,
player: {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/filters/Reset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class Reset extends Command {
usage: "reset",
},
category: "filters",
aliases: ["reset"],
aliases: ["rs"],
cooldown: 3,
args: false,
player: {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/info/Botinfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class Botinfo extends Command {
usage: "botinfo",
},
category: "info",
aliases: ["info", "bi"],
aliases: ["bi", "info", "stats", "status"],
cooldown: 3,
args: false,
player: {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/info/Invite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default class Invite extends Command {
usage: "invite",
},
category: "info",
aliases: ["inv"],
aliases: ["iv"],
cooldown: 3,
args: false,
player: {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/music/Grab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class Grab extends Command {
usage: "grab",
},
category: "music",
aliases: [],
aliases: ["gr"],
cooldown: 3,
args: false,
player: {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/music/Join.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class Join extends Command {
usage: "join",
},
category: "music",
aliases: ["j"],
aliases: ["come", "j"],
cooldown: 3,
args: false,
player: {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/music/Pause.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class Pause extends Command {
usage: "pause",
},
category: "music",
aliases: [],
aliases: ["pu"],
cooldown: 3,
args: false,
player: {
Expand Down
8 changes: 5 additions & 3 deletions src/commands/music/Play.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ export default class Play extends Command {
super(client, {
name: "play",
description: {
content: "Plays a song from YouTube or Spotify",
content: "Plays a song from YouTube, Spotify or http",
examples: [
"play https://www.youtube.com/watch?v=QH2-TGUlwu4",
"play https://open.spotify.com/track/6WrI0LAC5M1Rw2MnX2ZvEg",
"play example",
"play https://www.youtube.com/watch?v=example",
"play https://open.spotify.com/track/example",
"play http://www.example.com/example.mp3",
],
usage: "play <song>",
},
Expand Down
6 changes: 4 additions & 2 deletions src/commands/music/PlayNext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ export default class PlayNext extends Command {
description: {
content: "Add the song to play next in queue",
examples: [
"playnext https://www.youtube.com/watch?v=QH2-TGUlwu4",
"playnext https://open.spotify.com/track/6WrI0LAC5M1Rw2MnX2ZvEg",
"playnext example",
"playnext https://www.youtube.com/watch?v=example",
"playnext https://open.spotify.com/track/example",
"playnext http://www.example.com/example.mp3",
],
usage: "playnext <song>",
},
Expand Down
2 changes: 1 addition & 1 deletion src/commands/music/Resume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default class Resume extends Command {
description: {
content: "Resumes the current song",
examples: ["resume"],
usage: "resume",
usage: "re",
},
category: "music",
aliases: ["r"],
Expand Down
4 changes: 2 additions & 2 deletions src/commands/music/Search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export default class Search extends Command {
name: "search",
description: {
content: "Searches for a song",
examples: ["search", "search <song>"],
usage: "search",
examples: ["search example"],
usage: "search <song>",
},
category: "music",
aliases: ["sc"],
Expand Down
6 changes: 3 additions & 3 deletions src/commands/music/Seek.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ export default class Seek extends Command {
name: "seek",
description: {
content: "Seeks to a certain time in the song",
examples: ["seek 1m, seek 1h 30m"],
usage: "seek <time>",
examples: ["seek 1m, seek 1h 30m", "seek 1h 30m 30s"],
usage: "seek <duration>",
},
category: "music",
aliases: ["se"],
aliases: ["s"],
cooldown: 3,
args: true,
player: {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/music/Skipto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class Skipto extends Command {
usage: "skipto <number>",
},
category: "music",
aliases: ["st"],
aliases: ["skt"],
cooldown: 3,
args: true,
player: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class Volume extends Command {
usage: "volume <number>",
},
category: "music",
aliases: ["vol"],
aliases: ["v", "vol"],
cooldown: 3,
args: true,
player: {
Expand Down
3 changes: 1 addition & 2 deletions src/commands/playlist/Add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default class AddPlaylist extends Command {
usage: "add <playlist> <song>",
},
category: "playlist",
aliases: ["add"],
aliases: ["a"],
cooldown: 3,
args: true,
player: {
Expand Down Expand Up @@ -89,7 +89,6 @@ export default class AddPlaylist extends Command {
}
}


/**
* Project: lavamusic
* Author: Appu
Expand Down
2 changes: 1 addition & 1 deletion src/commands/playlist/Create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class CreatePlaylist extends Command {
usage: "create <name>",
},
category: "playlist",
aliases: ["create"],
aliases: ["cre"],
cooldown: 3,
args: true,
player: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { Command, type Context, type Lavamusic } from "../../structures/index.js
export default class DeletePlaylist extends Command {
constructor(client: Lavamusic) {
super(client, {
name: "delete",
name: "deletepl",
description: {
content: "Deletes a playlist",
examples: ["delete <playlist name>"],
usage: "delete <playlist name>",
examples: ["deletepl <playlist name>"],
usage: "deletepl <playlist name>",
},
category: "playlist",
aliases: ["del"],
aliases: ["delpl"],
cooldown: 3,
args: true,
player: {
Expand Down
4 changes: 2 additions & 2 deletions src/commands/playlist/Load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class LoadPlaylist extends Command {
usage: "load <playlist>",
},
category: "playlist",
aliases: [],
aliases: ["lo"],
cooldown: 3,
args: true,
player: {
Expand Down Expand Up @@ -73,7 +73,7 @@ export default class LoadPlaylist extends Command {
player.queue.push(track);
player.isPlaying();
}
await player.isPlaying()
await player.isPlaying();
return await ctx.sendMessage({
embeds: [
{
Expand Down
29 changes: 23 additions & 6 deletions src/commands/playlist/Remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import { Command, type Context, type Lavamusic } from "../../structures/index.js
export default class RemoveSong extends Command {
constructor(client: Lavamusic) {
super(client, {
name: "deletus",
name: "remove",
description: {
content: "Removes a song from the playlist",
examples: ["deletus <playlist> <song>"],
usage: "deletus <playlist> <song>",
examples: ["remove <playlist> <song>"],
usage: "remove <playlist> <song>",
},
category: "playlist",
aliases: ["dl"],
aliases: ["del"],
cooldown: 3,
args: true,
player: {
Expand Down Expand Up @@ -60,7 +60,10 @@ export default class RemoveSong extends Command {
const playlistData = await client.db.getPlaylist(ctx.author.id, playlist);

if (!playlistData) {
const playlistNotFoundError = this.client.embed().setDescription("[That playlist doesn't exist]").setColor(this.client.color.red);
const playlistNotFoundError = this.client
.embed()
.setDescription("[That playlist doesn't exist]")
.setColor(this.client.color.red);
return await ctx.sendMessage({ embeds: [playlistNotFoundError] });
}

Expand All @@ -84,8 +87,22 @@ export default class RemoveSong extends Command {
ctx.sendMessage({ embeds: [successMessage] });
} catch (error) {
console.error(error);
const genericError = this.client.embed().setDescription("[An error occurred while removing the song]").setColor(this.client.color.red);
const genericError = this.client
.embed()
.setDescription("[An error occurred while removing the song]")
.setColor(this.client.color.red);
return await ctx.sendMessage({ embeds: [genericError] });
}
}
}

/**
* Project: lavamusic
* Author: Appu
* Main Contributor: LucasB25
* Company: Coders
* Copyright (c) 2024. All rights reserved.
* 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
*/
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ export default class StealPlaylist extends Command {
super(client, {
name: "steal",
description: {
content: "Steals a playlist from another user and adds it to your account",
content: "Steals a playlist from another user",
examples: ["steal <playlist_name> <@user>"],
usage: "steal <playlist_name> <@user>",
},
category: "playlist",
aliases: ["steal"],
aliases: ["st"],
cooldown: 3,
args: true,
player: {
Expand All @@ -34,9 +34,9 @@ export default class StealPlaylist extends Command {
},
{
name: "user",
description: "The user from whom you want to steal the playlist",
description: "The user from who you want to steal the playlist",
type: 6,
required: true, // 6 represents a USER type in Discord API
required: true,
},
],
});
Expand All @@ -47,10 +47,10 @@ export default class StealPlaylist extends Command {
let userId;
let targetUser = ctx.args[0];

if (targetUser && targetUser.startsWith('<@') && targetUser.endsWith('>')) {
if (targetUser && targetUser.startsWith("<@") && targetUser.endsWith(">")) {
targetUser = targetUser.slice(2, -1);

if (targetUser.startsWith('!')) {
if (targetUser.startsWith("!")) {
targetUser = targetUser.slice(1);
}

Expand All @@ -77,7 +77,10 @@ export default class StealPlaylist extends Command {
const targetPlaylist = await client.db.getPlaylist(targetUserId, playlistName);

if (!targetPlaylist) {
const playlistNotFoundError = this.client.embed().setDescription("[That playlist doesn't exist for the mentioned user]").setColor(this.client.color.red);
const playlistNotFoundError = this.client
.embed()
.setDescription("[That playlist doesn't exist for the mentioned user]")
.setColor(this.client.color.red);
return await ctx.sendMessage({ embeds: [playlistNotFoundError] });
}

Expand All @@ -91,7 +94,10 @@ export default class StealPlaylist extends Command {
await ctx.sendMessage({ embeds: [successMessage] });
} catch (error) {
console.error(error);
const errorMessage = this.client.embed().setDescription("[An error occurred while stealing the playlist]").setColor(this.client.color.red);
const errorMessage = this.client
.embed()
.setDescription("[An error occurred while stealing the playlist]")
.setColor(this.client.color.red);
await ctx.sendMessage({ embeds: [errorMessage] });
}
}
Expand Down
Loading

0 comments on commit 7194d9a

Please sign in to comment.