diff options
| author | Alee <alee14498@gmail.com> | 2018-03-25 09:36:32 -0400 |
|---|---|---|
| committer | Alee <alee14498@gmail.com> | 2018-03-25 09:36:32 -0400 |
| commit | 9f39777642b3f44386df711afeab6490dc508007 (patch) | |
| tree | 90789522e4920934ff0012129525c18c6768953b /src/music.js | |
| parent | 07fe0f9f68d078881c44ddeaadbf09212f089727 (diff) | |
| download | AleeBot-9f39777642b3f44386df711afeab6490dc508007.tar.gz AleeBot-9f39777642b3f44386df711afeab6490dc508007.tar.bz2 AleeBot-9f39777642b3f44386df711afeab6490dc508007.zip | |
Moved all source files
Diffstat (limited to 'src/music.js')
| -rw-r--r-- | src/music.js | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/src/music.js b/src/music.js deleted file mode 100644 index b2df43d..0000000 --- a/src/music.js +++ /dev/null @@ -1,68 +0,0 @@ -// Created by jtsshieh#6434 in the BonGon project: https://github.com/jtsshieh/BonGon - -const YTDL = require('ytdl-core'); -module.exports.playYT = async (bot, connection, msg) => { - const EventEmitter = require('events'); - class MyEmitter extends EventEmitter {} - bot.musicEmit = new MyEmitter(); - - const musicvariables = require('./music.js').MusicVariables; - const server = musicvariables(bot, msg.member.guild.id); - - server.dispatcher = connection; - - connection.playStream(YTDL(server.queue[0].url, { - filter: 'audioonly' - })); - - server.nowPlaying = server.queue[0]; - server.beforeNowPlaying = server.nowPlaying; - - - server.queue.shift(); - - server.nowPlaying.playing = true; - - let time = 0; - let counter = setInterval( - function() { - time = time + 1; - server.dispatcher.time = time; - }, 1000); - - bot.musicEmit.on('paused', () => { - clearInterval(counter); - }); - - bot.musicEmit.on('resumed',() =>{ - counter = setInterval( - function() { - time = time + 1; - server.dispatcher.time = time; - }, 1000); - }); - - connection.once('end', function() { - clearInterval(counter); - - if (server.queue[0] || server.beforeNowPlaying) { - if (server.repeat) { - server.queue.push(server.beforeNowPlaying); - } - - server.nowPlaying = null; - bot.playYT(connection, msg); - } - - else { - bot.leaveVoiceChannel(connection.channelID); - bot.servers[msg.member.guild.id] = null; - } - }); -}; -module.exports.MusicVariables = (bot, guildID) => { - if (!bot.servers[guildID]) { - bot.servers[guildID] = {'queue' : [], 'dispatcher': null, 'repeat': false}; - } - return bot.servers[guildID]; -}; |
