aboutsummaryrefslogtreecommitdiff
path: root/AudioBackend.js
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2022-03-30 16:34:24 -0400
committerAndrew Lee <alee14498@protonmail.com>2022-03-30 16:34:24 -0400
commit3f81f1086f46b8e1882ed0827483a22929330be3 (patch)
tree4bda5790eb359f53d4e5671225f38e18a1ce56b9 /AudioBackend.js
parentfd89e36490da711ba611c1f7c8dda93a3de054f0 (diff)
downloadDLAP-3f81f1086f46b8e1882ed0827483a22929330be3.tar.gz
DLAP-3f81f1086f46b8e1882ed0827483a22929330be3.tar.bz2
DLAP-3f81f1086f46b8e1882ed0827483a22929330be3.zip
Renamed project; Auto creates music folder when not detected; Removed audio limitation
Diffstat (limited to 'AudioBackend.js')
-rw-r--r--AudioBackend.js16
1 files changed, 4 insertions, 12 deletions
diff --git a/AudioBackend.js b/AudioBackend.js
index 5960f3e..d7b6852 100644
--- a/AudioBackend.js
+++ b/AudioBackend.js
@@ -1,6 +1,6 @@
/**************************************************************************
*
- * DLMP3 Bot: A Discord bot that plays local MP3 audio tracks.
+ * DLAP Bot: A Discord bot that plays local audio tracks.
* (C) Copyright 2022
* Programmed by Andrew Lee
*
@@ -64,20 +64,12 @@ export async function voiceInit(bot) {
export async function searchAudio(bot){
//TODO: Eventually this system will need a rework so it won't repeat the same files.
- while (true) {
- audio = files[Math.floor(Math.random() * files.length)];
- console.log('Searching .mp3 file...');
- if (audio.endsWith('.mp3')) {
- break;
- }
- }
-
+ audio = files[Math.floor(Math.random() * files.length)];
return await playAudio(bot);
}
export async function inputAudio(bot, integer) {
- audio = files[integer]
-
+ audio = files[integer];
return await playAudio(bot);
}
@@ -86,6 +78,7 @@ export async function playAudio(bot) {
await player.play(resource);
+ audio = audio.split('.').slice(0, -1).join('.');
console.log('Now playing: ' + audio);
if (config.txtFile === true) {
@@ -107,7 +100,6 @@ export async function playAudio(bot) {
}
export function destroyAudio(interaction) {
-
if (config.txtFile === true) {
fileData = "Now Playing: Nothing";
fs.writeFile("now-playing.txt", fileData, (err) => {