diff --git a/source/commands/music/autoplay.js b/source/commands/music/autoplay.js index 2cfc8706..2229f50f 100644 --- a/source/commands/music/autoplay.js +++ b/source/commands/music/autoplay.js @@ -2,10 +2,10 @@ module.exports.run = (client, message, args) => { const queue = client.music.getQueue(message); if (!queue) return message.reply(client.translate.commands.autoplay.no_queue); - if (message.author.id !== queue.songs[0].user.id) return message.reply(client.translate.commands.autoplay.not_queue_owner); + if (message.author.id !== queue.songs[0].user.id && queue.autoplay === false) return message.reply(client.translate.commands.autoplay.not_queue_owner); const mode = client.music.toggleAutoplay(message); - + message.channel.send(client.translate.commands.autoplay.auto_playing.replace("%s", (mode ? client.translate.commands.autoplay.on : client.translate.commands.autoplay.off))); }; diff --git a/source/commands/music/filter.js b/source/commands/music/filter.js index 60a1ab0a..406c4d81 100644 --- a/source/commands/music/filter.js +++ b/source/commands/music/filter.js @@ -4,7 +4,7 @@ module.exports.run = (client, message, args) => { const filterList = Object.keys(client.music.filters); if (!queue) return message.reply(client.translate.commands.filter.no_queue); - if (message.author.id !== queue.songs[0].user.id) return message.reply(client.translate.commands.filter.not_queue_owner); + if (message.author.id !== queue.songs[0].user.id && queue.autoplay === false) return message.reply(client.translate.commands.filter.not_queue_owner); if (!inputType) return message.reply({ "content": client.translate.commands.filter.sound_filtering, "embeds": [ diff --git a/source/commands/music/join.js b/source/commands/music/join.js index d57508d2..4d085c26 100644 --- a/source/commands/music/join.js +++ b/source/commands/music/join.js @@ -5,7 +5,7 @@ module.exports.run = (client, message, args) => { const inputChannel = args.join(" "); const queue = client.music.getQueue(message); - if (queue && message.author.id !== queue.songs[0].user.id) return message.reply(client.translate.commands.join.another_player_is_playing); + if (queue && message.author.id !== queue.songs[0].user.id && queue.autoplay === false) return message.reply(client.translate.commands.join.another_player_is_playing); if (!inputChannel) { const voiceChannel = message.member.voice.channel; const meChannel = message.guild.me.voice.channel; diff --git a/source/commands/music/jump.js b/source/commands/music/jump.js index 6f337867..3ceb7728 100644 --- a/source/commands/music/jump.js +++ b/source/commands/music/jump.js @@ -3,7 +3,7 @@ module.exports.run = (client, message, args) => { const queue = client.music.getQueue(message); if (!queue) return message.reply(client.translate.commands.jump.no_queue); - if (message.author.id !== queue.songs[0].user.id) return message.reply(client.translate.commands.jump.not_queue_owner); + if (message.author.id !== queue.songs[0].user.id && queue.autoplay === false) return message.reply(client.translate.commands.jump.not_queue_owner); if (!inputAmount) return message.reply(client.translate.commands.jump.no_input); if (inputAmount <= 0) return message.reply(client.translate.commands.jump.too_low); if (inputAmount > queue.songs.length) return message.reply(client.translate.commands.jump.too_much); diff --git a/source/commands/music/leave.js b/source/commands/music/leave.js index 0cd761b9..000a7c7f 100644 --- a/source/commands/music/leave.js +++ b/source/commands/music/leave.js @@ -4,7 +4,7 @@ module.exports.run = (client, message, args) => { const inputChannel = args.join(" "); const queue = client.music.getQueue(message); - if (queue && message.author.id !== queue.songs[0].user.id) return message.reply(client.translate.commands.leave.another_player_is_playing); + if (queue && message.author.id !== queue.songs[0].user.id && queue.autoplay === false) return message.reply(client.translate.commands.leave.another_player_is_playing); if (!inputChannel) { const meChannel = message.guild.me.voice.channel; diff --git a/source/commands/music/pause.js b/source/commands/music/pause.js index 30535027..7aa082f7 100644 --- a/source/commands/music/pause.js +++ b/source/commands/music/pause.js @@ -2,7 +2,7 @@ module.exports.run = (client, message, args) => { const queue = client.music.getQueue(message); if (!queue) return message.reply(client.translate.commands.pause.no_queue); - if (message.author.id !== queue.songs[0].user.id) return message.reply(client.translate.commands.pause.not_owner); + if (message.author.id !== queue.songs[0].user.id && queue.autoplay === false) return message.reply(client.translate.commands.pause.not_owner); if (!queue.paused) return message.reply(client.translate.commands.pause.not_paused); client.music.pause(message); diff --git a/source/commands/music/play.js b/source/commands/music/play.js index cdb24a56..426b7985 100644 --- a/source/commands/music/play.js +++ b/source/commands/music/play.js @@ -14,7 +14,11 @@ module.exports.run = (client, message, args) => { "guildId": message.guild.id, "adapterCreator": message.guild.voiceAdapterCreator }); - client.music.play(message, inputName); + client.music.play(voiceChannel, inputName, { + "member": message.member, + "textChannel": message.channel, + message + }); } catch (error) { const connection = getVoiceConnection(voiceChannel.guild.id); diff --git a/source/commands/music/previous.js b/source/commands/music/previous.js index 79a5ae8b..549dfc60 100644 --- a/source/commands/music/previous.js +++ b/source/commands/music/previous.js @@ -2,7 +2,7 @@ module.exports.run = (client, message, args) => { const queue = client.music.getQueue(message); if (!queue) return message.reply(client.translate.commands.previous.no_queue); - if (message.author.id !== queue.songs[0].user.id) return message.reply(client.translate.commands.previous.not_owner); + if (message.author.id !== queue.songs[0].user.id && queue.autoplay === false) return message.reply(client.translate.commands.previous.not_owner); if (!queue.previousSongs) return message.reply(client.translate.commands.previous.no_previous_song_queue); client.music.previous(message); diff --git a/source/commands/music/remove.js b/source/commands/music/remove.js index d8595345..eb3ea4e5 100644 --- a/source/commands/music/remove.js +++ b/source/commands/music/remove.js @@ -3,7 +3,7 @@ module.exports.run = (client, message, args) => { const queue = client.music.getQueue(message); if (!queue) return message.reply(client.translate.commands.remove.no_queue); - if (message.author.id !== queue.songs[0].user.id) return message.reply(client.translate.commands.remove.not_owner); + if (message.author.id !== queue.songs[0].user.id && queue.autoplay === false) return message.reply(client.translate.commands.remove.not_owner); if (!inputAmount) return message.reply(client.translate.commands.remove.remove_guide.replace("%s", (client.config.prefix + module.exports.help.name))); if (inputAmount <= 0) return message.reply(client.translate.commands.remove.too_little); if (inputAmount >= queue.songs.length) return message.reply(client.translate.commands.remove.too_much); diff --git a/source/commands/music/repeat.js b/source/commands/music/repeat.js index 1d78d3c8..9addb5a8 100644 --- a/source/commands/music/repeat.js +++ b/source/commands/music/repeat.js @@ -3,7 +3,7 @@ module.exports.run = (client, message, args) => { const queue = client.music.getQueue(message); if (!queue) return message.reply(client.translate.commands.repeat.no_queue); - if (message.author.id !== queue.songs[0].user.id) return message.reply(client.translate.commands.repeat.not_owner); + if (message.author.id !== queue.songs[0].user.id && queue.autoplay === false) return message.reply(client.translate.commands.repeat.not_owner); if (!inputID) return message.reply(client.translate.commands.repeat.repeat_guide); if (inputID <= 0) return message.reply(client.translate.commands.repeat.too_little); if (inputID >= 2) return message.reply(client.translate.commands.repeat.too_much); diff --git a/source/commands/music/resume.js b/source/commands/music/resume.js index f598b9d9..578d9c4b 100644 --- a/source/commands/music/resume.js +++ b/source/commands/music/resume.js @@ -2,7 +2,7 @@ module.exports.run = (client, message, args) => { const queue = client.music.getQueue(message); if (!queue) return message.reply(client.translate.commands.resume.no_queue); - if (message.author.id !== queue.songs[0].user.id) return message.reply(client.translate.commands.resume.not_owner); + if (message.author.id !== queue.songs[0].user.id && queue.autoplay === false) return message.reply(client.translate.commands.resume.not_owner); if (queue.paused) return message.reply(client.translate.commands.resume.now_playing); client.music.resume(message); diff --git a/source/commands/music/search.js b/source/commands/music/search.js index f936df05..3db50ad6 100644 --- a/source/commands/music/search.js +++ b/source/commands/music/search.js @@ -19,7 +19,11 @@ module.exports.run = (client, message, args) => { "guildId": message.guild.id, "adapterCreator": message.guild.voiceAdapterCreator }); - client.music.play(message, inputSearch); + client.music.play(voiceChannel, inputSearch, { + "member": message.member, + "textChannel": message.channel, + message + }); } catch (error) { const connection = getVoiceConnection(voiceChannel.guild.id); diff --git a/source/commands/music/seek.js b/source/commands/music/seek.js index 180f3c8e..8caf20bd 100644 --- a/source/commands/music/seek.js +++ b/source/commands/music/seek.js @@ -7,7 +7,7 @@ module.exports.run = (client, message, args) => { const queueDuration = queue.songs.map((song, id) => song.duration); const queueFormatDuration = queue.songs.map((song, id) => song.formatDuration); - if (message.author.id !== queue.songs[0].user.id) return message.reply(client.translate.commands.seek.not_owner); + if (message.author.id !== queue.songs[0].user.id && queue.autoplay === false) return message.reply(client.translate.commands.seek.not_owner); if (!inputTime) return message.reply(client.translate.commands.seek.seek_guide.replace("%s", queueDuration)); if (inputTime <= 0) return message.reply(client.translate.commands.seek.too_little); if (inputTime >= queueDuration) return message.reply(client.translate.commands.seek.too_much.replace("%s", queueFormatDuration)); diff --git a/source/commands/music/shuffle.js b/source/commands/music/shuffle.js index d84cfc97..628d23be 100644 --- a/source/commands/music/shuffle.js +++ b/source/commands/music/shuffle.js @@ -2,7 +2,7 @@ module.exports.run = (client, message, args) => { const queue = client.music.getQueue(message); if (!queue) return message.reply(client.translate.commands.shuffle.no_queue); - if (message.author.id !== queue.songs[0].user.id) return message.reply(client.translate.commands.shuffle.not_owner); + if (message.author.id !== queue.songs[0].user.id && queue.autoplay === false) return message.reply(client.translate.commands.shuffle.not_owner); client.music.shuffle(message); message.channel.send(client.translate.commands.shuffle.now_shuffle); diff --git a/source/commands/music/skip.js b/source/commands/music/skip.js index dc5d6b26..624bf746 100644 --- a/source/commands/music/skip.js +++ b/source/commands/music/skip.js @@ -2,7 +2,7 @@ module.exports.run = (client, message, args) => { let queue = client.music.getQueue(message); if (!queue) return message.reply(client.translate.commands.skip.no_queue); - if (message.author.id !== queue.songs[0].user.id) return message.reply(client.translate.commands.skip.not_owner); + if (message.author.id !== queue.songs[0].user.id && queue.autoplay === false) return message.reply(client.translate.commands.skip.not_owner); client.music.skip(message); message.channel.send(client.translate.commands.skip.skipped); diff --git a/source/commands/music/stop.js b/source/commands/music/stop.js index e35040fd..64822b1b 100644 --- a/source/commands/music/stop.js +++ b/source/commands/music/stop.js @@ -2,7 +2,7 @@ module.exports.run = (client, message, args) => { const queue = client.music.getQueue(message); if (!queue) return message.reply(client.translate.commands.stop.no_queue); - if (message.author.id !== queue.songs[0].user.id) return message.reply(client.translate.commands.stop.not_owner); + if (message.author.id !== queue.songs[0].user.id && queue.autoplay === false) return message.reply(client.translate.commands.stop.not_owner); client.music.stop(message); message.channel.send(client.translate.commands.stop.stopped); diff --git a/source/commands/music/volume.js b/source/commands/music/volume.js index 0a3254e7..1692062f 100644 --- a/source/commands/music/volume.js +++ b/source/commands/music/volume.js @@ -6,7 +6,7 @@ module.exports.run = (client, message, args) => { const queueVolume = queue.volume; - if (message.author.id !== queue.songs[0].user.id) return message.reply(client.translate.commands.volume.not_owner); + if (message.author.id !== queue.songs[0].user.id && queue.autoplay === false) return message.reply(client.translate.commands.volume.not_owner); if (!inputPercent) return message.reply(client.translate.commands.volume.this_volume.replace("%s", queueVolume)); if (inputPercent <= 0) return message.reply(client.translate.commands.volume.too_little); if (inputPercent >= 101) return message.reply(client.translate.commands.volume.too_much);