1
0
mirror of https://github.com/musix-org/musix-oss synced 2025-07-07 13:50:49 +00:00

additional error logging and debugging.

This commit is contained in:
MatteZ02
2020-06-22 00:41:30 +03:00
parent 70316495f5
commit 2d7752d2cf
18 changed files with 126 additions and 87 deletions

View File

@ -1,12 +1,11 @@
module.exports = async function (client, error, guild) {
const queue = client.queue.get(guild.id);
console.error(error);
console.log(error);
/*if (error = "Error: input stream: This video contains content from WMG, who has blocked it on copyright grounds.") {
queue.endReason = "skip";
queue.connection.dispatcher.end();
return queue.textChannel.send(client.messages.songBlockedWMG);
}*/
client.users.cache.get(client.config.devId).send(client.messages.dispatcherError + error);
queue.voiceChannel.leave();
client.queue.delete(guild.id);
return queue.textChannel.send(client.messages.errorDispatcher + `\`${error}\``);

View File

@ -1,22 +1,24 @@
module.exports = async function (client, reason, guild) {
const queue = client.queue.get(guild.id);
queue.playing = false;
if (reason === "seek") {
return (queue.playing = true);
}
if (!queue.songLooping) {
if (queue.looping) {
queue.songs.push(queue.songs[0]);
module.exports = {
async execute(client, guild) {
const queue = client.queue.get(guild.id);
queue.playing = false;
if (queue.endReason === "seek") {
return (queue.playing = true);
}
queue.time = 0;
queue.votes = 0;
queue.voters = [];
if (reason !== "replay") {
if (reason === "previous") queue.songs.unshift(queue.prevSongs.pop())
if (reason !== "previous") queue.prevSongs.push(queue.songs.shift());
if (!queue.songLooping) {
if (queue.looping) {
queue.songs.push(queue.songs[0]);
}
queue.time = 0;
queue.votes = 0;
queue.voters = [];
if (queue.endReason !== "replay") {
if (queue.endReason === "previous") queue.songs.unshift(queue.prevSongs.pop())
if (queue.endReason !== "previous") queue.prevSongs.push(queue.songs.shift());
}
}
}
client.funcs.play(guild, queue.songs[0], client, 0, true);
client.funcs.play(guild, queue.songs[0], client, 0, true);
},
};

View File

@ -0,0 +1,16 @@
module.exports = function (client, dispatcher, queue, guild) {
dispatcher.on("finish", () => {
if (client.config.devMode) console.log("Dispatcher finish.");
require("./finish").execute(client, guild);
})
.on("start", () => {
if (client.config.devMode) console.log("Dispatcher start.");
queue.endReason = null;
dispatcher.player.streamingData.pausedTime = 0;
})
.on("error", (error) => {
require("./error").execute(client, error, guild);
}).on("debug", (info) => {
if (client.config.devMode) console.log(info);
})
}