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); const queue = player.getQueue(interaction.guildID);
if (!queue || !queue.playing) return void interaction.followUp({ content: "❌ | No music is being played!" }); if (!queue || !queue.playing) return void interaction.followUp({ content: "❌ | No music is being played!" });
const currentTrack = queue.current; const currentTrack = queue.current;
const tracks = queue.tracks const tracks = queue.tracks.slice(0, 10).map((m, i) => {
.slice(0, 10) return `${i + 1}. **${m.title}**`;
.map((m, i) => { });
return `${i + 1}. **${m.title}**`;
})
.join("\n");
return void interaction.followUp({ return void interaction.followUp({
embeds: [ embeds: [
{ {
title: "Server Queue", 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, color: 0xff0000,
fields: [{ name: "Now Playing", value: `🎶 | **${currentTrack.title}**` }] fields: [{ name: "Now Playing", value: `🎶 | **${currentTrack.title}**` }]
} }

View file

@ -19,7 +19,7 @@ class QueryResolver {
static resolve(query: string): QueryType { static resolve(query: string): QueryType {
if (SoundcloudValidateURL(query, "track")) return QueryType.SOUNDCLOUD_TRACK; if (SoundcloudValidateURL(query, "track")) return QueryType.SOUNDCLOUD_TRACK;
if (SoundcloudValidateURL(query, "playlist") || query.includes("/sets/")) return QueryType.SOUNDCLOUD_PLAYLIST; 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 (YouTube.validate(query, "PLAYLIST_ID")) return QueryType.YOUTUBE_PLAYLIST;
if (spotifySongRegex.test(query)) return QueryType.SPOTIFY_SONG; if (spotifySongRegex.test(query)) return QueryType.SPOTIFY_SONG;
if (spotifyPlaylistRegex.test(query)) return QueryType.SPOTIFY_PLAYLIST; if (spotifyPlaylistRegex.test(query)) return QueryType.SPOTIFY_PLAYLIST;