diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2020-07-20 17:12:55 -0400 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2020-07-20 17:12:55 -0400 |
| commit | ce9290f4407ce6bd72ed77a373d14f455c5b0f87 (patch) | |
| tree | b93a9525c23ed8241098c6354f949e5050235fb0 | |
| parent | 2bba86c3bf5319dadc050bd492dfe243dcd77bf6 (diff) | |
| download | DLAP-ce9290f4407ce6bd72ed77a373d14f455c5b0f87.tar.gz DLAP-ce9290f4407ce6bd72ed77a373d14f455c5b0f87.tar.bz2 DLAP-ce9290f4407ce6bd72ed77a373d14f455c5b0f87.zip | |
Skip command is back
| -rw-r--r-- | README.md | 1 | ||||
| -rw-r--r-- | bot.js | 16 |
2 files changed, 13 insertions, 4 deletions
@@ -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 @@ -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!'); |
