aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2022-12-06 20:22:27 -0500
committerAndrew Lee <alee14498@protonmail.com>2022-12-06 20:22:27 -0500
commit85a535956f5b6fbb035dca090123ece7fa8be8b5 (patch)
tree27d12f147be55c3741a130208799bb9442a4753c /backend
parentf91f277a30a081cde95805bf39adeb835be98c3f (diff)
downloadDLAP-85a535956f5b6fbb035dca090123ece7fa8be8b5.tar.gz
DLAP-85a535956f5b6fbb035dca090123ece7fa8be8b5.tar.bz2
DLAP-85a535956f5b6fbb035dca090123ece7fa8be8b5.zip
Used ChatGPT to fix certain problems; Removed more unnessesary stuff
Diffstat (limited to 'backend')
-rw-r--r--backend/AudioControl.js5
-rw-r--r--backend/PlayAudio.js2
-rw-r--r--backend/Shutdown.js2
3 files changed, 3 insertions, 6 deletions
diff --git a/backend/AudioControl.js b/backend/AudioControl.js
index 2b314d2..447e040 100644
--- a/backend/AudioControl.js
+++ b/backend/AudioControl.js
@@ -22,7 +22,6 @@ import { readdirSync, readFileSync } from 'node:fs';
import { shufflePlaylist, orderPlaylist } from './QueueSystem.js';
import { playAudio, currentTrack, updatePlaylist } from './PlayAudio.js';
import { player } from './VoiceInitialization.js';
-import { destroyAudio } from './Shutdown.js';
const { shuffle, repeat } = JSON.parse(readFileSync('./config.json', 'utf-8'));
export const files = readdirSync('music');
@@ -44,8 +43,7 @@ async function repeatCheck(bot) {
}
export async function nextAudio(bot) {
- totalTrack--;
- if (currentTrack >= totalTrack) {
+ if (currentTrack >= totalTrack - 1) {
await repeatCheck(bot);
} else {
updatePlaylist('next');
@@ -54,7 +52,6 @@ export async function nextAudio(bot) {
}
export async function previousAudio(bot, interaction) {
- totalTrack++;
if (currentTrack <= 0) {
return await interaction.reply({ content: 'You are at the beginning of the playlist, cannot go further than this', ephemeral: true });
} else {
diff --git a/backend/PlayAudio.js b/backend/PlayAudio.js
index d698798..fea4b3d 100644
--- a/backend/PlayAudio.js
+++ b/backend/PlayAudio.js
@@ -62,7 +62,7 @@ export async function playAudio(bot) {
} else {
metadataEmpty = true;
}
- duration = new Date(format.duration * 1000).toISOString().substr(11, 8);
+ duration = new Date(format.duration * 1000).toISOString().slice(11, 19);
} catch (e) {
console.error(e);
}
diff --git a/backend/Shutdown.js b/backend/Shutdown.js
index e1c1d26..fb89505 100644
--- a/backend/Shutdown.js
+++ b/backend/Shutdown.js
@@ -55,6 +55,6 @@ export async function stopBot(bot, interaction) {
console.log(`Powering off ${bot.user.username}...`);
await destroyAudio(interaction);
- bot.destroy();
+ await bot.destroy();
return process.exit(0);
}