Update (v2.0.1)

This commit is contained in:
Zerio
2020-11-26 22:10:44 +01:00
committed by GitHub
parent a021632e3d
commit d6cbfeffef

View File

@@ -1,27 +1,23 @@
const emotes = require("../config/emojis.json");
const filters = require("../config/filters.json");
exports.run = async (client, message, args) => {
if (!message.member.voice.channel) return message.channel.send(`You're not in a voice channel ${emotes.error}`);
if (!message.member.voice.channel) return message.channel.send(`${client.emotes.error} - You're not in a voice channel !`);
if (!client.player.getQueue(message)) return message.channel.send(`No songs currently playing ${emotes.error}`);
if (!client.player.getQueue(message)) return message.channel.send(`${client.emotes.error} - No songs currently playing !`);
const filter = args[0];
if (!filter) return message.channel.send(`Please specify a valid filter to enable or disable ${emotes.error}`);
if (!args[0]) return message.channel.send(`${client.emotes.error} - Please specify a valid filter to enable or disable !`);
const filterToUpdate = Object.values(filters).find((f) => f.toLowerCase() === filter.toLowerCase());
const filterToUpdate = Object.values(client.filters).find((f) => f.toLowerCase() === args[0].toLowerCase());
if (!filterToUpdate) return message.channel.send(`This filter doesn't exist ${emotes.error}`);
if (!filterToUpdate) return message.channel.send(`${client.emotes.error} - This filter doesn't exist !`);
const filterRealName = Object.keys(filters).find((f) => filters[f] === filterToUpdate);
const filterRealName = Object.keys(client.filters).find((f) => client.filters[f] === filterToUpdate);
const queueFilters = client.player.getQueue(message).filters
const filtersUpdated = {};
filtersUpdated[filterRealName] = queueFilters[filterRealName] ? false : true;
client.player.setFilters(message, filtersUpdated);
if (filtersUpdated[filterRealName]) message.channel.send(`I'm **adding** the filter to the music, please wait... Note : the longer the music is, the longer this will take ${emotes.music}`);
else message.channel.send(`I'm **disabling** the filter on the music, please wait... Note : the longer the music is playing, the longer this will take ${emotes.music}`);
if (filtersUpdated[filterRealName]) message.channel.send(`${client.emotes.music} - I'm **adding** the filter to the music, please wait... Note : the longer the music is, the longer this will take.`);
else message.channel.send(`${client.emotes.music} - I'm **disabling** the filter on the music, please wait... Note : the longer the music is playing, the longer this will take.`);
};