aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2022-12-02 00:31:17 -0500
committerAndrew Lee <alee14498@protonmail.com>2022-12-02 00:40:10 -0500
commite0fe64b06c0eb8b92578ae1bf5a166f8d633c9b3 (patch)
treeaf930df72f7bfeb2a3ca7c11321f894b02ad7411 /backend
parentebdf6e92b146d1bad3b0e295e926f9e43e26c532 (diff)
downloadDLAP-e0fe64b06c0eb8b92578ae1bf5a166f8d633c9b3.tar.gz
DLAP-e0fe64b06c0eb8b92578ae1bf5a166f8d633c9b3.tar.bz2
DLAP-e0fe64b06c0eb8b92578ae1bf5a166f8d633c9b3.zip
Fixed duration date; More stop functions; Required in voice channel
Diffstat (limited to 'backend')
-rw-r--r--backend/AudioControl.js2
-rw-r--r--backend/PlayAudio.js13
2 files changed, 5 insertions, 10 deletions
diff --git a/backend/AudioControl.js b/backend/AudioControl.js
index f26d9d1..216d610 100644
--- a/backend/AudioControl.js
+++ b/backend/AudioControl.js
@@ -76,7 +76,9 @@ export function audioState(state) {
break;
case 2:
playerState = 'Stopped';
+ totalTrack = files.length;
isAudioStatePaused = true;
+ player.stop();
break;
}
}
diff --git a/backend/PlayAudio.js b/backend/PlayAudio.js
index 77a33bc..9b4a83b 100644
--- a/backend/PlayAudio.js
+++ b/backend/PlayAudio.js
@@ -59,14 +59,7 @@ export async function playAudio(bot) {
} else {
metadataEmpty = true;
}
- const toHHMMSS = (numSecs) => {
- const secNum = parseInt(numSecs, 10);
- const hours = Math.floor(secNum / 3600).toString().padStart(2, '0');
- const minutes = Math.floor((secNum - (hours * 3600)) / 60).toString().padStart(2, '0');
- const seconds = secNum - (hours * 3600) - (minutes * 60).toString().padStart(2, '0');
- return `${hours}:${minutes}:${seconds}`;
- };
- duration = toHHMMSS(format.duration);
+ duration = new Date(format.duration * 1000).toISOString().substr(11, 8);
} catch (e) {
console.error(e);
}
@@ -104,8 +97,8 @@ export async function playAudio(bot) {
return await channel.send({ embeds: [statusEmbed] });
}
-export function updatePlaylist(i) {
- switch (i) {
+export function updatePlaylist(option) {
+ switch (option) {
case 'next':
currentTrack++;
audio = files[currentTrack];