diff options
| -rw-r--r-- | bot.js | 10 | ||||
| -rw-r--r-- | commands/Music/play.js | 30 | ||||
| -rw-r--r-- | commands/Music/skip.js | 23 | ||||
| -rw-r--r-- | plugins/music.js | 59 |
4 files changed, 2 insertions, 120 deletions
@@ -9,7 +9,7 @@ bot.commands = new Discord.Collection(); bot.aliases = new Discord.Collection(); bot.categories = new Discord.Collection(); bot.queue = new Discord.Collection(); -bot.plugins = { music : require('./plugins/music.js') , +bot.plugins = { economy : require('./plugins/Economy.js'), settings : require('./plugins/settings.js'), whitelist: require('./plugins/whitelist.js'), @@ -85,16 +85,10 @@ fs.readdir('./events', (err, files) => { }); -const { PlayerManager } = require('discord.js-lavalink'); -const nodes = [ - { 'host': 'localhost', 'port': 6547, 'region': 'us', 'shard': 1, 'password': 'iamaverysecurepassword' }, -]; process.on('unhandledRejection', (err) => { console.error(err.stack); bot.Raven.captureException(err); }); -bot.login(config.token).then(() => { - bot.player = new PlayerManager(bot, nodes, { user: bot.user.id, shards: 1, password: 'iamaverysecurepassword' }); -}); +bot.login(config.token); diff --git a/commands/Music/play.js b/commands/Music/play.js deleted file mode 100644 index c494ea2..0000000 --- a/commands/Music/play.js +++ /dev/null @@ -1,30 +0,0 @@ -/** ************************************** - * - * Play: Plugin for PokeBot that performs music player actions. - * Copyright (C) 2018 TheEdge, jtsshieh, Alee - * - * Licensed under the Open Software License version 3.0 - * - * *************************************/ - -exports.run = async (bot, msg, args) => { - const music = bot.plugins.music; - if (args[0] == 'sc') { - args.shift(); - const track = await music.resolveTrack(args.join(' '), true); - return music.play(bot, msg, track.track); - } - const track = await music.resolveTrack(args.join(' ')); - return music.play(bot, msg, track.track); -}; - -exports.conf = { - aliases: [], - guildOnly: true, -}; - -exports.help = { - name: 'play', - description: 'Plays a song for you. If sc is not chosen, it\'ll be yt', - usage : '<sc> <search>', -}; diff --git a/commands/Music/skip.js b/commands/Music/skip.js deleted file mode 100644 index 96cecf6..0000000 --- a/commands/Music/skip.js +++ /dev/null @@ -1,23 +0,0 @@ -/** ************************************** - * - * Skip: Plugin for PokeBot that performs music player actions. - * Copyright (C) 2018 TheEdge, jtsshieh, Alee - * - * Licensed under the Open Software License version 3.0 - * - * *************************************/ - -exports.run = async (bot, msg) => { - const music = bot.plugins.music; - music.skip(bot, msg); -}; - -exports.conf = { - aliases: [], - guildOnly: true, -}; - -exports.help = { - name: 'skip', - description: 'Skip a song in the queue.', -}; diff --git a/plugins/music.js b/plugins/music.js deleted file mode 100644 index 2dbabda..0000000 --- a/plugins/music.js +++ /dev/null @@ -1,59 +0,0 @@ -/** ************************************** - * - * Music: Plugin for PokeBot that interacts with the Lavalink API. - * Copyright (C) 2018 TheEdge, jtsshieh, Alee - * - * Licensed under the Open Software License version 3.0 - * - * *************************************/ - -exports.resolveTrack = async (term, sc) => { - const fetch = require('snekfetch'); - let track = await fetch.get('http://localhost:2344/loadtracks?identifier=' + term, { headers: { Authorization: 'iamaverysecurepassword' } }); - if (!track.body[0]) { - const search = 'http://localhost:2344/loadtracks?identifier=' + (sc ? 'scsearch:' : 'ytsearch:') + term; - track = await fetch.get(search, { headers: { Authorization: 'iamaverysecurepassword' } }); - } - return track.body[0]; -}; - -exports.play = async (bot, msg, track) => { - const player = await bot.player.join({ - d: { - guild_id: msg.guild.id, - channel_id: msg.member.voiceChannelID, - }, - host: 'localhost', - }); - if (!bot.queue.has(msg.guild.id)) { - bot.queue.set(msg.guild.id, []); - bot.queue.get(msg.guild.id).push(track); - player.play(bot.queue.get(msg.guild.id).shift()); - player.on('end', () => { - if (bot.queue.get(msg.guild.id)[0]) { - player.play(bot.queue.get(msg.guild.id).shift()); - } - else { - bot.player.leave(msg.guild.id); - } - }); - } - else { - bot.queue.get(msg.guild.id).push(track); - } -}; - -exports.skip = async (bot, msg) => { - const player = await bot.player.join({ - guild: msg.guild.id, - channel: msg.member.voiceChannelID, - host: 'localhost', - }); - if (bot.queue.has(msg.guild.id)) { - player.stop(); - player.emit('end'); - } - else { - return msg.channel.send('There is nothing playing.'); - } -}; |
