From f83f0c012b540873a66a3c2f1861561d2a83c447 Mon Sep 17 00:00:00 2001 From: MatteZ02 <47610069+MatteZ02@users.noreply.github.com> Date: Mon, 2 Mar 2020 22:54:01 +0200 Subject: [PATCH] update --- commands/nowplaying.js | 1 - commands/stop.js | 2 -- events/dispatcher/finish.js | 20 -------------------- struct/client.js | 1 - struct/funcs/handleRadio.js | 4 +--- struct/funcs/play.js | 4 ++-- 6 files changed, 3 insertions(+), 29 deletions(-) delete mode 100644 events/dispatcher/finish.js diff --git a/commands/nowplaying.js b/commands/nowplaying.js index eeb3a63..3732737 100644 --- a/commands/nowplaying.js +++ b/commands/nowplaying.js @@ -15,7 +15,6 @@ module.exports = { const embed = new Discord.MessageEmbed() .setTitle("__Now playing__") .setDescription(`**Now playing:** ${radio.url}\n\`${client.funcs.msToTime(completed, "hh:mm:ss")}\``) - .setURL(radio.songs[0].url) .setThumbnail(thumbnail._rejectionHandler0) .setColor(client.config.embedColor) return msg.channel.send(embed); diff --git a/commands/stop.js b/commands/stop.js index 1b14540..fd422be 100644 --- a/commands/stop.js +++ b/commands/stop.js @@ -9,8 +9,6 @@ module.exports = { execute(msg, args, client, Discord, prefix, command) { const radio = client.radio.get(msg.guild.id); if (client.funcs.check(client, msg, command)) { - radio.songs = []; - radio.looping = false; radio.connection.dispatcher.end('Stopped'); msg.channel.send('<:stop:674685626108477519> Stopped the music!') } diff --git a/events/dispatcher/finish.js b/events/dispatcher/finish.js deleted file mode 100644 index ff59c68..0000000 --- a/events/dispatcher/finish.js +++ /dev/null @@ -1,20 +0,0 @@ -module.exports = async function (client, reason, guild) { - const radio = client.radio.get(guild.id); - radio.playing = false; - if (reason === "Stream is not generating quickly enough.") { - console.log("Song ended"); - } else if (reason === "seek") { - return; - } else { - console.log(reason); - } - if (!radio.songLooping) { - if (radio.looping) { - radio.songs.push(radio.songs[0]); - } - radio.votes = 0; - radio.voters = []; - radio.songs.shift(); - } - client.funcs.play(guild, radio.songs[0], client, 0, true); -}; \ No newline at end of file diff --git a/struct/client.js b/struct/client.js index 246678c..37069e2 100644 --- a/struct/client.js +++ b/struct/client.js @@ -16,7 +16,6 @@ module.exports = class extends Client { this.funcs = {}; this.dispatcher = {}; this.config = require('./config/config.js'); - this.dispatcher.finish = require('../events/dispatcher/finish.js'); fs.readdirSync(path.join(__dirname, 'funcs')).forEach(filename => { this.funcs[filename.slice(0, -3)] = require(`./funcs/${filename}`); diff --git a/struct/funcs/handleRadio.js b/struct/funcs/handleRadio.js index 4a32697..ec419c5 100644 --- a/struct/funcs/handleRadio.js +++ b/struct/funcs/handleRadio.js @@ -2,9 +2,7 @@ module.exports = async function (msg, voiceChannel, client, url) { const radio = client.radio.get(msg.guild.id); if (radio) { - radio.songs.push(song); - if (playlist) return; - return msg.channel.send(`<:green_check_mark:674265384777416705> **${song.title}** has been added to the queue!`); + radio.connection.dispatcher.end('Stopped'); } const construct = { diff --git a/struct/funcs/play.js b/struct/funcs/play.js index 4cc448e..fc2981c 100644 --- a/struct/funcs/play.js +++ b/struct/funcs/play.js @@ -3,8 +3,8 @@ module.exports = async function (guild, client, url) { const radio = client.radio.get(guild.id); const dispatcher = radio.connection .play(url, { bitrate: 1024, passes: 10, volume: 1, highWaterMark: 1 << 25 }) - .on("finish", reason => { - client.dispatcher.finish(client, reason, guild); + .on("finish", () => { + radio.delete(); }); dispatcher.on('start', () => { dispatcher.player.streamingData.pausedTime = 0;