aboutsummaryrefslogtreecommitdiff
path: root/bot.js
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2020-07-20 17:12:55 -0400
committerAndrew Lee <alee14498@protonmail.com>2020-07-20 17:12:55 -0400
commitce9290f4407ce6bd72ed77a373d14f455c5b0f87 (patch)
treeb93a9525c23ed8241098c6354f949e5050235fb0 /bot.js
parent2bba86c3bf5319dadc050bd492dfe243dcd77bf6 (diff)
downloadDLAP-ce9290f4407ce6bd72ed77a373d14f455c5b0f87.tar.gz
DLAP-ce9290f4407ce6bd72ed77a373d14f455c5b0f87.tar.bz2
DLAP-ce9290f4407ce6bd72ed77a373d14f455c5b0f87.zip
Skip command is back
Diffstat (limited to 'bot.js')
-rw-r--r--bot.js16
1 files changed, 12 insertions, 4 deletions
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!');