diff options
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | bot.js | 12 | ||||
| -rw-r--r-- | music/README.md | 1 |
3 files changed, 14 insertions, 1 deletions
@@ -1,4 +1,4 @@ token.json node_modules yarn.lock -music
\ No newline at end of file +music/*.mp3
\ No newline at end of file @@ -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); diff --git a/music/README.md b/music/README.md new file mode 100644 index 0000000..968afb5 --- /dev/null +++ b/music/README.md @@ -0,0 +1 @@ +# Put your music here
\ No newline at end of file |
