mirror of
https://github.com/musix-org/musix-oss
synced 2025-06-16 18:56:00 +00:00
Updated multiple things
This commit is contained in:
13
events/dispatcher/error.js
Normal file
13
events/dispatcher/error.js
Normal file
@ -0,0 +1,13 @@
|
||||
module.exports = async function (client, error, guild) {
|
||||
const queue = client.queue.get(guild.id);
|
||||
console.error(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.debug_channel.send(client.messages.dispatcherError + error);
|
||||
queue.voiceChannel.leave();
|
||||
client.queue.delete(guild.id);
|
||||
return queue.textChannel.send(client.messages.errorDispatcher);
|
||||
};
|
@ -1,17 +1,17 @@
|
||||
module.exports = async function (client, reason, guild) {
|
||||
const serverQueue = client.queue.get(guild.id);
|
||||
serverQueue.playing = false;
|
||||
const queue = client.queue.get(guild.id);
|
||||
queue.playing = false;
|
||||
if (reason === "seek") {
|
||||
return;
|
||||
}
|
||||
if (!serverQueue.songLooping) {
|
||||
if (serverQueue.looping) {
|
||||
serverQueue.songs.push(serverQueue.songs[0]);
|
||||
if (!queue.songLooping) {
|
||||
if (queue.looping) {
|
||||
queue.songs.push(queue.songs[0]);
|
||||
}
|
||||
|
||||
serverQueue.votes = 0;
|
||||
serverQueue.voters = [];
|
||||
serverQueue.songs.shift();
|
||||
queue.votes = 0;
|
||||
queue.voters = [];
|
||||
queue.songs.shift();
|
||||
}
|
||||
client.funcs.play(guild, serverQueue.songs[0], client, 0, true);
|
||||
client.funcs.play(guild, queue.songs[0], client, 0, true);
|
||||
};
|
@ -22,8 +22,8 @@ module.exports = {
|
||||
if (commandName === "none") return;
|
||||
const command = client.commands.get(commandName) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName)) || client.commandAliases.get(commandName);
|
||||
if (!command && msg.content !== `${prefix}`) return;
|
||||
if (command.onlyDev && msg.author.id !== client.config.devId) return msg.channel.send(client.messages.notAllowed);
|
||||
//if (client.config.devMode && msg.member.id !== client.config.devId) return msg.channel.send(client.messages.devMode);
|
||||
if (command.onlyDev && msg.author.id !== client.config.devId) return;
|
||||
if (client.config.devMode && msg.member.id !== client.config.devId) return msg.channel.send(client.messages.devMode);
|
||||
client.funcs.exe(msg, args, client, Discord, prefix, command);
|
||||
}
|
||||
}
|
@ -2,30 +2,30 @@ module.exports = {
|
||||
name: 'voiceStateUpdate',
|
||||
async execute(client, oldState, newState) {
|
||||
let change = false;
|
||||
const serverQueue = client.queue.get(newState.guild.id);
|
||||
if (!serverQueue) return;
|
||||
const queue = client.queue.get(newState.guild.id);
|
||||
if (!queue) return;
|
||||
if (newState.member.id === client.user.id && oldState.member.id === client.user.id) {
|
||||
if (newState.member.voice.channel === null) {
|
||||
serverQueue.songs = [];
|
||||
serverQueue.looping = false;
|
||||
serverQueue.endReason = "manual disconnect";
|
||||
queue.songs = [];
|
||||
queue.looping = false;
|
||||
queue.endReason = "manual disconnect";
|
||||
return client.queue.delete(newState.guild.id);
|
||||
}
|
||||
if (newState.member.voice.channel !== serverQueue.voiceChannel) {
|
||||
if (newState.member.voice.channel !== queue.voiceChannel) {
|
||||
change = true;
|
||||
serverQueue.voiceChannel = newState.member.voice.channel;
|
||||
serverQueue.connection = newState.connection;
|
||||
queue.voiceChannel = newState.member.voice.channel;
|
||||
queue.connection = newState.connection;
|
||||
}
|
||||
}
|
||||
if (oldState.channel === null) return;
|
||||
if (oldState.channel.members.size === 1 && oldState.channel === serverQueue.voiceChannel || change) {
|
||||
if (oldState.channel.members.size === 1 && oldState.channel === queue.voiceChannel || change) {
|
||||
setTimeout(() => {
|
||||
if (!serverQueue) return;
|
||||
if (serverQueue.voiceChannel.members.size === 1) {
|
||||
serverQueue.songs = [];
|
||||
serverQueue.looping = false;
|
||||
serverQueue.endReason = "Timeout";
|
||||
serverQueue.connection.dispatcher.end();
|
||||
if (!queue) return;
|
||||
if (queue.voiceChannel.members.size === 1) {
|
||||
queue.songs = [];
|
||||
queue.looping = false;
|
||||
queue.endReason = "Timeout";
|
||||
queue.connection.dispatcher.end();
|
||||
}
|
||||
}, 12000);
|
||||
}
|
||||
|
Reference in New Issue
Block a user