From ce9290f4407ce6bd72ed77a373d14f455c5b0f87 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Mon, 20 Jul 2020 17:12:55 -0400 Subject: Skip command is back --- bot.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'bot.js') diff --git a/bot.js b/bot.js index 982045c..58ee36a 100644 --- a/bot.js +++ b/bot.js @@ -10,6 +10,7 @@ const Discord = require('discord.js'); const fs = require('fs'); const client = new Discord.Client(); const config = require('./config.json'); +let dispatcher; client.login(config.token); @@ -30,7 +31,7 @@ function playAudio() { } } - const dispatcher = connection.play('./music/' + audio); + dispatcher = connection.play('./music/' + audio); console.log('Now playing ' + audio); let serviceChannel = client.channels.cache.get('606602551634296968'); @@ -46,11 +47,11 @@ function playAudio() { } client.on('ready', () => { - console.log('Bot is ready!') + console.log('Bot is ready!'); console.log(`Logged in as ${client.user.tag}!`); console.log(`Prefix: ${config.prefix}`); - console.log(`Owner ID: ${config.botOwner}`) - console.log(`Voice Channel: ${config.voiceChannel}`) + console.log(`Owner ID: ${config.botOwner}`); + console.log(`Voice Channel: ${config.voiceChannel}`); client.user.setStatus('invisible'); playAudio(); @@ -91,6 +92,13 @@ client.on('message', async msg => { playAudio(); } + if (command == 'skip') { + msg.reply("Skipping...") + dispatcher.pause(); + dispatcher = null + playAudio(); + } + if (command == 'leave') { const channel = client.channels.cache.get(config.voiceChannel); if (!channel) return console.error('The channel does not exist!'); -- cgit v1.2.3