diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2022-07-08 12:09:06 -0400 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2022-07-08 12:09:06 -0400 |
| commit | 2471564098b1de1a635d90f381ef67cf2cb43511 (patch) | |
| tree | c0e92769059e51187f8645f2b43bf26a8cef8a71 /AudioBackend.js | |
| parent | 83e4c8679c656ecb352ddc34d5dced9518ba240a (diff) | |
| download | DLAP-2471564098b1de1a635d90f381ef67cf2cb43511.tar.gz DLAP-2471564098b1de1a635d90f381ef67cf2cb43511.tar.bz2 DLAP-2471564098b1de1a635d90f381ef67cf2cb43511.zip | |
New command; Some tweaks
Diffstat (limited to 'AudioBackend.js')
| -rw-r--r-- | AudioBackend.js | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/AudioBackend.js b/AudioBackend.js index d1f54c4..bdd3738 100644 --- a/AudioBackend.js +++ b/AudioBackend.js @@ -48,8 +48,9 @@ export async function voiceInit(bot) { adapterCreator: channel.guild.voiceAdapterCreator }); - connection.on(VoiceConnectionStatus.Ready, () => { + connection.on(VoiceConnectionStatus.Ready, async () => { console.log('Ready to blast some beats!'); + await shufflePlaylist(bot); }); connection.on(VoiceConnectionStatus.Destroyed, () => { @@ -61,7 +62,6 @@ export async function voiceInit(bot) { nextAudio(bot); }) - await shufflePlaylist(bot); return connection.subscribe(player); }).catch(e => { console.error(e) }) } @@ -84,7 +84,7 @@ function shuffleArray(array) { return array; } -async function shufflePlaylist(bot) { +export async function shufflePlaylist(bot) { console.log('Shuffling beats...'); currentTrack = 0 audioArray = files; @@ -97,12 +97,10 @@ async function shufflePlaylist(bot) { export async function nextAudio(bot) { let totalTrack = files.length totalTrack-- - console.log(totalTrack) if (currentTrack > totalTrack) { console.log('All beats in the playlist has finished, reshuffling...') await shufflePlaylist(); } else { - console.log(files.length) currentTrack++ audio = audioArray[currentTrack]; } |
