diff options
| author | Max Isom <[email protected]> | 2020-03-18 19:17:47 -0500 |
|---|---|---|
| committer | Max Isom <[email protected]> | 2020-03-18 19:17:47 -0500 |
| commit | 035737312360279efd5026b225f30ef14aa55abf (patch) | |
| tree | 87155d94e351abe640d0de02c0125ee6bd2491b3 /src/commands | |
| parent | a0c5875ee43166a9565e4a086a701864c52f549d (diff) | |
| download | muse-035737312360279efd5026b225f30ef14aa55abf.tar.xz muse-035737312360279efd5026b225f30ef14aa55abf.zip | |
Limit playlist adds to 50 songs
Diffstat (limited to 'src/commands')
| -rw-r--r-- | src/commands/play.ts | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/commands/play.ts b/src/commands/play.ts index bcafdbf..eceac94 100644 --- a/src/commands/play.ts +++ b/src/commands/play.ts @@ -71,6 +71,7 @@ export default class implements Command { } const newSongs: QueuedSong[] = []; + let extraMsg = ''; // Test if it's a complete URL try { @@ -95,7 +96,15 @@ export default class implements Command { } } } else if (url.protocol === 'spotify:' || url.host === 'open.spotify.com') { - const [convertedSongs] = await this.getSongs.spotifySource(args[0]); + const [convertedSongs, nSongsNotFound, totalSongs] = await this.getSongs.spotifySource(args[0]); + + if (totalSongs > 50) { + extraMsg = 'a random sample of 50 songs was taken'; + } + + if (nSongsNotFound !== 0) { + extraMsg += `and ${nSongsNotFound.toString()} songs were not found`; + } newSongs.push(...convertedSongs); } @@ -122,10 +131,14 @@ export default class implements Command { const firstSong = newSongs[0]; + if (extraMsg !== '') { + extraMsg = ` (${extraMsg})`; + } + if (newSongs.length === 1) { - await res.stop(`u betcha, **${firstSong.title}** added to the queue`); + await res.stop(`u betcha, **${firstSong.title}** added to the queue${extraMsg}`); } else { - await res.stop(`u betcha, **${firstSong.title}** and ${newSongs.length - 1} other songs were added to the queue`); + await res.stop(`u betcha, **${firstSong.title}** and ${newSongs.length - 1} other songs were added to the queue${extraMsg}`); } if (this.playerManager.get(msg.guild!.id).voiceConnection === null) { |
