From 85a535956f5b6fbb035dca090123ece7fa8be8b5 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Tue, 6 Dec 2022 20:22:27 -0500 Subject: Used ChatGPT to fix certain problems; Removed more unnessesary stuff --- README.md | 2 +- backend/AudioControl.js | 5 +---- backend/PlayAudio.js | 2 +- backend/Shutdown.js | 2 +- bot.js | 1 - 5 files changed, 4 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 4dcd8aa..d4356f5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # DLAP Bot (Discord.JS Local Audio Player) -A Discord bot that plays local audio tracks. Written in Discord.JS v14. +DLAP is a Discord bot that lets you play local audio tracks in your server. With DLAP, you can access your music files, and share your tunes with your friends and community. DLAP offers seamless integration with Discord, so you can enjoy your music without missing a beat. [Video Tutorial](https://youtu.be/Gvva8LHjOOo) | [Support Server](https://discord.gg/EFhRDqG) 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); } diff --git a/bot.js b/bot.js index ef01d55..9944f24 100644 --- a/bot.js +++ b/bot.js @@ -28,7 +28,6 @@ bot.login(token); /** * TODO: - Custom string support (Basically change what the bot is saying) - * - Non repeat support * - Easier to use interface */ -- cgit v1.2.3