From 91153826cea0dd7696edcf2700dd2c152f9c1dc4 Mon Sep 17 00:00:00 2001 From: Snowflake107 Date: Sun, 13 Jun 2021 14:29:49 +0545 Subject: [PATCH] example bot --- example/index.ts | 15 ++++++++------- src/utils/QueryResolver.ts | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/example/index.ts b/example/index.ts index 5972a84..e3b90e4 100644 --- a/example/index.ts +++ b/example/index.ts @@ -149,18 +149,19 @@ client.on("interaction", async (interaction) => { const queue = player.getQueue(interaction.guildID); if (!queue || !queue.playing) return void interaction.followUp({ content: "❌ | No music is being played!" }); const currentTrack = queue.current; - const tracks = queue.tracks - .slice(0, 10) - .map((m, i) => { - return `${i + 1}. **${m.title}**`; - }) - .join("\n"); + const tracks = queue.tracks.slice(0, 10).map((m, i) => { + return `${i + 1}. **${m.title}**`; + }); return void interaction.followUp({ embeds: [ { title: "Server Queue", - description: `${tracks}${queue.tracks.length > tracks.length ? `...${queue.tracks.length - tracks.length} more tracks` : ""}`, + description: `${tracks.join("\n")}${ + queue.tracks.length > tracks.length + ? `\n...${queue.tracks.length - tracks.length === 1 ? `${queue.tracks.length - tracks.length} more track` : `${queue.tracks.length - tracks.length} more tracks`}` + : "" + }`, color: 0xff0000, fields: [{ name: "Now Playing", value: `🎶 | **${currentTrack.title}**` }] } diff --git a/src/utils/QueryResolver.ts b/src/utils/QueryResolver.ts index 918b845..42269b5 100644 --- a/src/utils/QueryResolver.ts +++ b/src/utils/QueryResolver.ts @@ -19,7 +19,7 @@ class QueryResolver { static resolve(query: string): QueryType { if (SoundcloudValidateURL(query, "track")) return QueryType.SOUNDCLOUD_TRACK; if (SoundcloudValidateURL(query, "playlist") || query.includes("/sets/")) return QueryType.SOUNDCLOUD_PLAYLIST; - if (validateID(query) || validateURL(query)) return QueryType.YOUTUBE; + if (validateID(query) || validateURL(query)) return QueryType.YOUTUBE_SEARCH; if (YouTube.validate(query, "PLAYLIST_ID")) return QueryType.YOUTUBE_PLAYLIST; if (spotifySongRegex.test(query)) return QueryType.SPOTIFY_SONG; if (spotifyPlaylistRegex.test(query)) return QueryType.SPOTIFY_PLAYLIST;