aboutsummaryrefslogtreecommitdiff
path: root/bot.js
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2020-07-20 00:03:18 -0400
committerAndrew Lee <alee14498@protonmail.com>2020-07-20 00:03:18 -0400
commit7b32c9e4555d446edd4e13241cde4ff6a91ea3a1 (patch)
tree931bf7bf72d5c4fba08a53d245680c5679ac3420 /bot.js
parentbdd54224708544a0646aa18f79d254f937ba6f35 (diff)
downloadDLAP-7b32c9e4555d446edd4e13241cde4ff6a91ea3a1.tar.gz
DLAP-7b32c9e4555d446edd4e13241cde4ff6a91ea3a1.tar.bz2
DLAP-7b32c9e4555d446edd4e13241cde4ff6a91ea3a1.zip
Fetching audio
Diffstat (limited to 'bot.js')
-rw-r--r--bot.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/bot.js b/bot.js
index 5bd763c..4aa58eb 100644
--- a/bot.js
+++ b/bot.js
@@ -7,17 +7,29 @@
*
*********************************************/
const Discord = require('discord.js');
+const fs = require("fs");
const client = new Discord.Client();
const config = require('./token.json');
let botOwner = "242775871059001344";
var voiceChannel = "734184921433899108";
var prefix = "!";
+function fetchAudio() {
+ fs.readdir('./music', (err, files) => {
+ if (err) console.error(err);
+ files.forEach(function (file) {
+ // Do whatever you want to do with the file
+ console.log(`Fetching ${file}`);
+ });
+ });
+}
+
function playAudio() {
const channel = client.channels.cache.get(voiceChannel);
if (!channel) return console.error("The channel does not exist!");
channel.join().then(connection => {
console.log("Connected to the voice channel.");
+ fetchAudio();
connection.play('./music/4616-werq-by-kevin-macleod.mp3');
}).catch(e => {
console.error(e);