example bot

This commit is contained in:
Snowflake107 2021-06-13 14:29:49 +05:45
parent 02d77264d7
commit 91153826ce
2 changed files with 9 additions and 8 deletions

View file

@ -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}**` }]
}

View file

@ -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;