From 1a4fe99d1ccd3ef6c379d3cc215bf0e513b79bf6 Mon Sep 17 00:00:00 2001 From: Nikos <53112175+nikosszzz@users.noreply.github.com> Date: Wed, 18 Sep 2024 22:31:20 +0000 Subject: [PATCH] bot: very small cleanup --- src/commands/music/playlist.ts | 4 ++-- src/commands/music/queue.ts | 4 ++-- src/commands/music/volume.ts | 2 +- src/components/MusicQueue.ts | 2 +- src/components/Song.ts | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/commands/music/playlist.ts b/src/commands/music/playlist.ts index 2402483d..3c39cbd0 100644 --- a/src/commands/music/playlist.ts +++ b/src/commands/music/playlist.ts @@ -70,7 +70,7 @@ export default { }) } }); - interaction.client.queues.set(interaction.guild!.id as string, queue); + interaction.client.queues.set(interaction.guild!.id, queue); await queue.enqueue({ songs: playlist.videos }); } @@ -82,7 +82,7 @@ export default { { name: playlist.data instanceof SpotifyPlaylist || playlist.data instanceof SoundCloudPlaylist ? playlist.data.name : playlist.data.title!, value: "** **" }) - .setURL(playlist.data.url as string); + .setURL(playlist.data.url ?? null); return await interaction.editReply({ embeds: [playlistEmbed] }).catch((err: Error) => Logger.error({ type: "MUSICCMDS", err })); }, diff --git a/src/commands/music/queue.ts b/src/commands/music/queue.ts index d8d4001d..c8fc1bbd 100644 --- a/src/commands/music/queue.ts +++ b/src/commands/music/queue.ts @@ -16,7 +16,7 @@ export default { .setDescription("There is nothing playing in the queue currently."); if (!queue || !queue.songs || !queue.songs.length) return await interaction.reply({ embeds: [nothingPlaying], ephemeral: true }); - let currentPage: number = 0 as number; + let currentPage = 0; const embeds = generateQueueEmbed(interaction, queue.songs); const queueButtons = new ActionRowBuilder() @@ -88,7 +88,7 @@ function generateQueueEmbed(interaction: ChatInputCommandInteraction, .setAuthor({ name: "Track Queue" }) .setTitle(`Current Song - ${songs[0].title}`) .setURL(songs[0].url) - .setThumbnail(interaction.guild!.iconURL() as string) + .setThumbnail(interaction.guild!.iconURL()) .setDescription(`**Displaying the queue list below:**\n\n${info}`) .setFooter({ text: `${songs.length} tracks.` }); diff --git a/src/commands/music/volume.ts b/src/commands/music/volume.ts index f9f59e51..75a6e0fb 100644 --- a/src/commands/music/volume.ts +++ b/src/commands/music/volume.ts @@ -12,7 +12,7 @@ export default { .setDescription("The volume level to set the music to.") ), async execute(interaction) { - const queue = interaction.client.queues.get(interaction.guild!.id as string); + const queue = interaction.client.queues.get(interaction.guild!.id); const volTarget = interaction.options.getNumber("level") as number; const notInVC = new EmbedBuilder() diff --git a/src/components/MusicQueue.ts b/src/components/MusicQueue.ts index 255c93e5..1bb3c16f 100644 --- a/src/components/MusicQueue.ts +++ b/src/components/MusicQueue.ts @@ -142,7 +142,7 @@ export class MusicQueue { if (this.player.state.status == AudioPlayerStatus.Playing || this.songs.length) return; - this.bot.queues.delete(this.interaction.guild!.id as string); + this.bot.queues.delete(this.interaction.guild!.id); this.textChannel.send("Left channel due to inactivity."); }, config.STAY_TIME * 1000); } diff --git a/src/components/Song.ts b/src/components/Song.ts index 278aea94..0218baca 100644 --- a/src/components/Song.ts +++ b/src/components/Song.ts @@ -52,7 +52,7 @@ export class Song { } else if (isSoundCloudUrl) { const scSong = await soundcloud(search) as SoundCloudTrack; return new this({ - title: scSong.name as string, + title: scSong.name, url: scSong.permalink, duration: scSong.durationInSec, durationRaw: undefined,