diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2020-07-19 13:42:52 -0400 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2020-07-19 13:42:52 -0400 |
| commit | d211d73230e7977e30736c21a119e6f696397d43 (patch) | |
| tree | aa845bb04cdffcf4c0c7cef176a887804c3aa13e /bot.js | |
| parent | 3602700e53a819fcf92d86d9fb27bd100f8ab720 (diff) | |
| download | DLAP-d211d73230e7977e30736c21a119e6f696397d43.tar.gz DLAP-d211d73230e7977e30736c21a119e6f696397d43.tar.bz2 DLAP-d211d73230e7977e30736c21a119e6f696397d43.zip | |
Removed fs and re-added playAudio function
Diffstat (limited to 'bot.js')
| -rw-r--r-- | bot.js | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -1,13 +1,10 @@ const Discord = require('discord.js'); const client = new Discord.Client(); const config = require('./token.json'); -const fs = require('fs'); -let prefix = "!"; +var prefix = "!"; var voiceChannel = "734184921433899108"; -client.on('ready', () => { - console.log(`Logged in as ${client.user.tag}!`); - console.log('Prefix:', prefix); +function playAudio() { const channel = client.channels.cache.get(voiceChannel); if (!channel) return console.error("The channel does not exist!"); channel.join().then(connection => { @@ -17,6 +14,12 @@ client.on('ready', () => { // Oh no, it errored! Let's log it to console :) console.error(e); }); +} + +client.on('ready', () => { + console.log(`Logged in as ${client.user.tag}!`); + console.log(`Prefix: ${prefix}`); + playAudio(); }); client.on('message', async msg => { @@ -40,8 +43,7 @@ client.on('message', async msg => { if (command == 'join') { // Only try to join the sender's voice channel if they are in one themselves - console.log("Connected to voice chat...") - const connection = await msg.member.voice.channel.join(); + playAudio(); } if (command == 'skip') { //TODO |
