This commit is contained in:
MatteZ02 2020-03-02 22:54:01 +02:00
parent df66048e95
commit f83f0c012b
6 changed files with 3 additions and 29 deletions

View File

@ -15,7 +15,6 @@ module.exports = {
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setTitle("__Now playing__") .setTitle("__Now playing__")
.setDescription(`<a:aNotes:674602408105476106>**Now playing:** ${radio.url}\n\`${client.funcs.msToTime(completed, "hh:mm:ss")}\``) .setDescription(`<a:aNotes:674602408105476106>**Now playing:** ${radio.url}\n\`${client.funcs.msToTime(completed, "hh:mm:ss")}\``)
.setURL(radio.songs[0].url)
.setThumbnail(thumbnail._rejectionHandler0) .setThumbnail(thumbnail._rejectionHandler0)
.setColor(client.config.embedColor) .setColor(client.config.embedColor)
return msg.channel.send(embed); return msg.channel.send(embed);

View File

@ -9,8 +9,6 @@ module.exports = {
execute(msg, args, client, Discord, prefix, command) { execute(msg, args, client, Discord, prefix, command) {
const radio = client.radio.get(msg.guild.id); const radio = client.radio.get(msg.guild.id);
if (client.funcs.check(client, msg, command)) { if (client.funcs.check(client, msg, command)) {
radio.songs = [];
radio.looping = false;
radio.connection.dispatcher.end('Stopped'); radio.connection.dispatcher.end('Stopped');
msg.channel.send('<:stop:674685626108477519> Stopped the music!') msg.channel.send('<:stop:674685626108477519> Stopped the music!')
} }

View File

@ -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);
};

View File

@ -16,7 +16,6 @@ module.exports = class extends Client {
this.funcs = {}; this.funcs = {};
this.dispatcher = {}; this.dispatcher = {};
this.config = require('./config/config.js'); this.config = require('./config/config.js');
this.dispatcher.finish = require('../events/dispatcher/finish.js');
fs.readdirSync(path.join(__dirname, 'funcs')).forEach(filename => { fs.readdirSync(path.join(__dirname, 'funcs')).forEach(filename => {
this.funcs[filename.slice(0, -3)] = require(`./funcs/${filename}`); this.funcs[filename.slice(0, -3)] = require(`./funcs/${filename}`);

View File

@ -2,9 +2,7 @@ module.exports = async function (msg, voiceChannel, client, url) {
const radio = client.radio.get(msg.guild.id); const radio = client.radio.get(msg.guild.id);
if (radio) { if (radio) {
radio.songs.push(song); radio.connection.dispatcher.end('Stopped');
if (playlist) return;
return msg.channel.send(`<:green_check_mark:674265384777416705> **${song.title}** has been added to the queue!`);
} }
const construct = { const construct = {

View File

@ -3,8 +3,8 @@ module.exports = async function (guild, client, url) {
const radio = client.radio.get(guild.id); const radio = client.radio.get(guild.id);
const dispatcher = radio.connection const dispatcher = radio.connection
.play(url, { bitrate: 1024, passes: 10, volume: 1, highWaterMark: 1 << 25 }) .play(url, { bitrate: 1024, passes: 10, volume: 1, highWaterMark: 1 << 25 })
.on("finish", reason => { .on("finish", () => {
client.dispatcher.finish(client, reason, guild); radio.delete();
}); });
dispatcher.on('start', () => { dispatcher.on('start', () => {
dispatcher.player.streamingData.pausedTime = 0; dispatcher.player.streamingData.pausedTime = 0;