From 3efc5bbe60b29d16af53c969523f035ef290ba68 Mon Sep 17 00:00:00 2001 From: Beelzebub <65181309+Beelzebub2@users.noreply.github.com> Date: Fri, 12 Jul 2024 16:13:13 +0100 Subject: [PATCH 1/3] Update Steal.ts i believe the suggested fix works, command behaved as normal Signed-off-by: Beelzebub <65181309+Beelzebub2@users.noreply.github.com> --- src/commands/playlist/Steal.ts | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/commands/playlist/Steal.ts b/src/commands/playlist/Steal.ts index e2ea77352..99da8abe7 100644 --- a/src/commands/playlist/Steal.ts +++ b/src/commands/playlist/Steal.ts @@ -5,12 +5,12 @@ export default class StealPlaylist extends Command { super(client, { name: "steal", description: { - content: "Steals a playlist from another user", + content: "Steals a playlist from another user and adds it to your account", examples: ["steal <@user>"], usage: "steal <@user>", }, category: "playlist", - aliases: ["st"], + aliases: ["steal"], cooldown: 3, args: true, player: { @@ -34,9 +34,9 @@ export default class StealPlaylist extends Command { }, { name: "user", - description: "The user from who you want to steal the playlist", + description: "The user from whom you want to steal the playlist", type: 6, - required: true, + required: true, // 6 represents a USER type in Discord API }, ], }); @@ -44,22 +44,22 @@ export default class StealPlaylist extends Command { public async run(client: Lavamusic, ctx: Context, args: string[]): Promise { const playlistName = args.shift(); - let userId; + 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); } targetUser = await client.users.fetch(targetUser); - userId = targetUser.id; + _userId = targetUser.id; } else if (targetUser) { targetUser = await client.users.fetch(ctx.args[0]); } else { - userId = ctx.author.id; + _userId = ctx.author.id; } if (!playlistName) { @@ -77,10 +77,7 @@ 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] }); } @@ -94,10 +91,7 @@ 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] }); } } From b48f6f795e5f80817b3b0c2a2eecc401a7c248e9 Mon Sep 17 00:00:00 2001 From: Beelzebub <65181309+Beelzebub2@users.noreply.github.com> Date: Fri, 12 Jul 2024 16:15:35 +0100 Subject: [PATCH 2/3] Update Steal.ts Signed-off-by: Beelzebub <65181309+Beelzebub2@users.noreply.github.com> --- src/commands/playlist/Steal.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/playlist/Steal.ts b/src/commands/playlist/Steal.ts index 99da8abe7..281fdd257 100644 --- a/src/commands/playlist/Steal.ts +++ b/src/commands/playlist/Steal.ts @@ -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 and adds it to your playlists", examples: ["steal <@user>"], usage: "steal <@user>", }, category: "playlist", - aliases: ["steal"], + aliases: ["st"], cooldown: 3, args: true, player: { From 69cf2336d82c81eb4a6f50158a476a0384ecea5a Mon Sep 17 00:00:00 2001 From: Beelzebub <65181309+Beelzebub2@users.noreply.github.com> Date: Fri, 12 Jul 2024 20:22:23 +0100 Subject: [PATCH 3/3] Update Steal.ts Signed-off-by: Beelzebub <65181309+Beelzebub2@users.noreply.github.com> --- src/commands/playlist/Steal.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/commands/playlist/Steal.ts b/src/commands/playlist/Steal.ts index 281fdd257..ce28861fd 100644 --- a/src/commands/playlist/Steal.ts +++ b/src/commands/playlist/Steal.ts @@ -47,7 +47,8 @@ export default class StealPlaylist extends Command { let _userId; let targetUser = ctx.args[0]; - if (targetUser && targetUser.startsWith('<@') && targetUser.endsWith('>')) { + if (targetUser?.startsWith("<@") && targetUser.endsWith(">")) { + targetUser = targetUser.slice(2, -1); if (targetUser.startsWith('!')) {