fixmusic can be used by users, invidious issues

This commit is contained in:
Emily 2020-05-28 17:52:15 +10:00
parent ac5d3dc78c
commit dddaeba8e3
3 changed files with 52 additions and 10 deletions

View file

@ -2,23 +2,60 @@ const { getGuild } = require('../modules/music')
module.exports.run = async (client, message, args, level) =>{
guild = getGuild(message.guild.id)
const lvl = client.config.permLevels.find(l => l.level === level)
if (lvl >= 1) {
guild.queue = []
guild.playing = false
guild.paused = false
guild.skippers = []
guild.fixers = []
if (guild.dispatcher) {
guild.dispatcher.end('silent')
}
message.channel.send('<:success:466995111885144095> Music has been fixed (hopefully)')
message.channel.send(
'<:success:466995111885144095> Music has been fixed!'
)
return
}
if (guild.fixers.indexOf(message.author.id) === -1) {
guild.fixers.push(message.author.id)
if (guild.fixers.length >= Math.ceil(vc.members.filter(member => !member.user.bot).size / 2)) {
guild.queue = []
guild.playing = false
guild.paused = false
guild.skippers = []
guild.fixers = []
if (guild.dispatcher) {
guild.dispatcher.end('silent')
}
message.channel.send(
'<:success:466995111885144095> Music has been fixed!'
)
} else {
message.channel.send(
`<:success:466995111885144095> Your vote has been acknowledged! **${guild.fixers.length + '/' + Math.ceil(vc.members.filter(member => !member.user.bot).size / 2)}**`
)
};
} else {
message.channel.send(
'<:denied:466995195150336020> You cannot vote twice!'
)
}
}
exports.conf = {
enabled: true,
guildOnly: true,
aliases: [],
permLevel: "Moderator",
permLevel: "User",
requiredPerms: []
};

View file

@ -11,6 +11,7 @@ exports.run = async (client, message) => {
guild.playing = false
guild.paused = false
guild.skippers = []
guild.fixers = []
message.channel.send('<:success:466995111885144095> Playback stopped!')
};

View file

@ -28,6 +28,7 @@ exports.getGuild = function (id) {
guild.paused = false
guild.dispatcher = null
guild.skippers = []
guild.fixers = []
exports.queue[id] = guild
}
@ -102,6 +103,7 @@ exports.play = async function (client, message, query, playNext, ignoreQueue) {
guild.playing = false
guild.paused = false
guild.skippers = []
guild.fixers = []
// music not playing, something is in queue
} else if (!guild.playing && !guild.dispatcher && guild.queue.length > 0) {
guild.queue = []
@ -200,8 +202,9 @@ exports.play = async function (client, message, query, playNext, ignoreQueue) {
guild.queue.pop()
}
client.logger.error(err)
return message.channel.send(`<:error:466995152976871434> An error has occured! If this issue persists, please contact my developers with this:\n\`${err}\``)
client.logger.error('(YT API change, disregard) ' + err)
// return message.channel.send(`<:error:466995152976871434> An error has occured! If this issue persists, please contact my developers with this:\n\`${err}\``)
return message.channel.send('<:error:466995152976871434> YouTube have made changes to their site that break Woomy\'s music module. An announcement will be made in the development server when this issue is resolved.')
}
guild.dispatcher.setVolume(0.25)
@ -219,6 +222,7 @@ exports.play = async function (client, message, query, playNext, ignoreQueue) {
guild.playing = false
guild.paused = false
guild.skippers = []
guild.fixers = []
connection.disconnect()
}