aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--bot.js16
2 files changed, 13 insertions, 4 deletions
diff --git a/README.md b/README.md
index c03e199..d96421b 100644
--- a/README.md
+++ b/README.md
@@ -24,6 +24,7 @@ about - About the bot
Bot Owner Only
--------------
join - Joins voice chat
+skip - Skips the audio track
leave - Leaves voice chat
stop - Stops bot
``` \ No newline at end of file
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!');