aboutsummaryrefslogtreecommitdiff
path: root/AudioBackend.js
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2022-07-08 12:09:06 -0400
committerAndrew Lee <alee14498@protonmail.com>2022-07-08 12:09:06 -0400
commit2471564098b1de1a635d90f381ef67cf2cb43511 (patch)
treec0e92769059e51187f8645f2b43bf26a8cef8a71 /AudioBackend.js
parent83e4c8679c656ecb352ddc34d5dced9518ba240a (diff)
downloadDLAP-2471564098b1de1a635d90f381ef67cf2cb43511.tar.gz
DLAP-2471564098b1de1a635d90f381ef67cf2cb43511.tar.bz2
DLAP-2471564098b1de1a635d90f381ef67cf2cb43511.zip
New command; Some tweaks
Diffstat (limited to 'AudioBackend.js')
-rw-r--r--AudioBackend.js8
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];
}