Merge pull request #9 from Androz2091/v2
This commit is contained in:
41
commands/filter.js
Normal file
41
commands/filter.js
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
const emotes = require ("../config/emojis.json");
|
||||||
|
const filters = require("../config/filters.json");
|
||||||
|
const Discord = require("discord.js")
|
||||||
|
|
||||||
|
module.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(!client.player.isPlaying(message.guild.id)) return message.channel.send(`**No music playing on this server ${emotes.error}**`);
|
||||||
|
|
||||||
|
const filter = args[0];
|
||||||
|
if(!filter) return message.channel.send(`**Please specify a valid filter to enable or disable ${emotes.error}**`);
|
||||||
|
|
||||||
|
const filterToUpdate = Object.values(filters).find((f) => f.toLowerCase() === filter.toLowerCase());
|
||||||
|
if(!filterToUpdate) return message.channel.send(`**This filter doesn't exist ${emotes.error}**`);
|
||||||
|
|
||||||
|
const filterRealName = Object.keys(filters).find((f) => filters[f] === filterToUpdate);
|
||||||
|
|
||||||
|
const queueFilters = client.player.getQueue(message.guild.id).filters
|
||||||
|
const filtersUpdated = {};
|
||||||
|
filtersUpdated[filterRealName] = queueFilters[filterRealName] ? false : true;
|
||||||
|
client.player.setFilters(message.guild.id, filtersUpdated);
|
||||||
|
|
||||||
|
if(filtersUpdated[filterRealName]){
|
||||||
|
const pleaseWait = new Discord.MessageEmbed()
|
||||||
|
.setDescription("I'm adding the filter to the music, please wait... Note : the longer the music is, the longer the wait will be :musical_note:")
|
||||||
|
.setColor("BLUE");
|
||||||
|
message.channel.send(pleaseWait);
|
||||||
|
} else {
|
||||||
|
const pleaseWait = new Discord.MessageEmbed()
|
||||||
|
.setDescription(`I'm disabling the filter on the music, please wait... Note : the longer the music is playing, the longer the wait will be... :musical_note:`)
|
||||||
|
.setColor("BLUE");
|
||||||
|
message.channel.send(pleaseWait);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.config = {
|
||||||
|
name: "filter",
|
||||||
|
aliases: []
|
||||||
|
};
|
||||||
@@ -6,9 +6,9 @@ module.exports.run = async (client, message) => {
|
|||||||
|
|
||||||
if(!client.player.isPlaying(message.guild.id)) return message.channel.send(`**No music playing on this server ${emotes.error}**`);
|
if(!client.player.isPlaying(message.guild.id)) return message.channel.send(`**No music playing on this server ${emotes.error}**`);
|
||||||
|
|
||||||
const song = await client.player.nowPlaying(message.guild.id);
|
const track = await client.player.nowPlaying(message.guild.id);
|
||||||
|
|
||||||
message.channel.send(`**Currently playing ${song.name} ${emotes.music}**`);
|
message.channel.send(`**Currently playing ${track.name} ${emotes.music}**`);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ module.exports.run = async (client, message) => {
|
|||||||
|
|
||||||
if(!client.player.isPlaying(message.guild.id)) return message.channel.send(`**No music playing on this server ${emotes.error}**`);
|
if(!client.player.isPlaying(message.guild.id)) return message.channel.send(`**No music playing on this server ${emotes.error}**`);
|
||||||
|
|
||||||
const song = await client.player.pause(message.guild.id);
|
const track = await client.player.pause(message.guild.id);
|
||||||
|
|
||||||
message.channel.send(`**Song ${song.name} paused ${emotes.success}**`);
|
message.channel.send(`**Track ${track.name} paused ${emotes.success}**`);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,17 +6,27 @@ module.exports.run = async (client, message, args) => {
|
|||||||
|
|
||||||
if (!args[0]) return message.channel.send(`**Please enter a music ${emotes.error}**`);
|
if (!args[0]) return message.channel.send(`**Please enter a music ${emotes.error}**`);
|
||||||
|
|
||||||
const aSongIsAlreadyPlaying = client.player.isPlaying(message.guild.id);
|
const aTrackIsAlreadyPlaying = client.player.isPlaying(message.guild.id);
|
||||||
|
|
||||||
// If there's already a song playing
|
// If there's already a track playing
|
||||||
if(aSongIsAlreadyPlaying){
|
if(aTrackIsAlreadyPlaying){
|
||||||
// Add the song to the queue
|
// Add the track to the queue
|
||||||
const song = await client.player.addToQueue(message.guild.id, args.join(" "));
|
const track = await client.player.addToQueue(message.guild.id, args.join(" "));
|
||||||
message.channel.send(`**Song ${song.name} added to queue ${emotes.music}**`);
|
message.channel.send(`**Track ${track.name} added to queue ${emotes.music}**`);
|
||||||
} else {
|
} else {
|
||||||
// Else, play the song
|
// Else, play the track
|
||||||
const song = await client.player.play(message.member.voice.channel, args.join(" "));
|
const track = await client.player.play(message.member.voice.channel, args.join(" "));
|
||||||
message.channel.send(`**Currently playing ${song.name} ${emotes.music}**`);
|
message.channel.send(`**Currently playing ${track.name} ${emotes.music}**`);
|
||||||
|
const queue = client.player.getQueue(message.guild.id)
|
||||||
|
.on('end', () => {
|
||||||
|
message.channel.send('There is no more music in the queue!');
|
||||||
|
})
|
||||||
|
.on('trackChanged', (oldTrack, newTrack) => {
|
||||||
|
message.channel.send(`Now playing ${newTrack.name}...`);
|
||||||
|
})
|
||||||
|
.on('channelEmpty', () => {
|
||||||
|
message.channel.send('Stop playing, there is no more member in the voice channel...');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,14 @@ module.exports.run = async (client, message) => {
|
|||||||
|
|
||||||
const queue = client.player.getQueue(message.guild.id);
|
const queue = client.player.getQueue(message.guild.id);
|
||||||
|
|
||||||
if(!queue) return message.channel.send(`**No songs currently playing ${emotes.error}**`);
|
if(!queue) return message.channel.send(`**No tracks currently playing ${emotes.error}**`);
|
||||||
|
|
||||||
message.channel.send(`**Server queue ${emotes.queue}** \n`+(queue.songs.map((song, i) => {
|
message.channel.send(`**Server queue ${emotes.queue}** \nCurrent - ${queue.playing.name} | ${queue.playing.author}\n`+
|
||||||
return `${i === 0 ? 'Current' : `#${i+1}`} - ${song.name} | ${song.author}`
|
(
|
||||||
}).join('\n')));
|
queue.tracks.map((track, i) => {
|
||||||
|
return `#${i+1} - ${track.name} | ${track.author}`
|
||||||
|
}).join('\n')
|
||||||
|
));
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ module.exports.run = async (client, message) => {
|
|||||||
|
|
||||||
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(`**You're not in a voice channel ${emotes.error}**`);
|
||||||
|
|
||||||
const song = await client.player.resume(message.guild.id);
|
const track = await client.player.resume(message.guild.id);
|
||||||
|
|
||||||
if(!song) return message.channel.send(`**No songs currently playing ${emotes.error}**`);
|
if(!track) return message.channel.send(`**No tracks currently playing ${emotes.error}**`);
|
||||||
|
|
||||||
message.channel.send(`**Song ${song.name} resumed ${emotes.success}**`);
|
message.channel.send(`**Track ${track.name} resumed ${emotes.success}**`);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ module.exports.run = async (client, message) => {
|
|||||||
|
|
||||||
if(!client.player.isPlaying(message.guild.id)) return message.channel.send(`**No music playing on this server ${emotes.error}**`);
|
if(!client.player.isPlaying(message.guild.id)) return message.channel.send(`**No music playing on this server ${emotes.error}**`);
|
||||||
|
|
||||||
const song = await client.player.skip(message.guild.id);
|
const track = await client.player.skip(message.guild.id);
|
||||||
|
|
||||||
message.channel.send(`**Song ${song.name} skipped ${emotes.success}**`);
|
message.channel.send(`**Track ${track.name} skipped ${emotes.success}**`);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
35
commands/w-filters.js
Normal file
35
commands/w-filters.js
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
const emotes = require("../config/emojis.json");
|
||||||
|
const filters = require("../config/filters.json");
|
||||||
|
const Discord = require("discord.js");
|
||||||
|
|
||||||
|
module.exports.run = async (client, message) => {
|
||||||
|
|
||||||
|
if (!message.member.voice.channel) return message.channel.send(`**You're not in a voice channel ${emotes.error}**`);
|
||||||
|
|
||||||
|
if (!client.player.isPlaying(message.guild.id)) return message.channel.send(`**No music playing on this server ${emotes.error}**`);
|
||||||
|
|
||||||
|
const enabledEmoji = emotes.success;
|
||||||
|
const disabledEmoji = emotes.error;
|
||||||
|
|
||||||
|
const filtersStatuses = [ [], [] ];
|
||||||
|
|
||||||
|
Object.keys(filters).forEach((filterName) => {
|
||||||
|
const array = filtersStatuses[0].length > filtersStatuses[1].length ? filtersStatuses[1] : filtersStatuses[0];
|
||||||
|
array.push(filters[filterName] + " : " + (client.player.getQueue(message.guild.id).filters[filterName] ? enabledEmoji : disabledEmoji));
|
||||||
|
});
|
||||||
|
|
||||||
|
const list = new Discord.MessageEmbed()
|
||||||
|
.setDescription("Liste de tous les filtres activés ou non.\nPour ajouter un filtre sur une musique `^filter`.")
|
||||||
|
.addField("**Filtres**", filtersStatuses[0].join('\n'), true)
|
||||||
|
.addField("** **", filtersStatuses[1].join('\n'), true)
|
||||||
|
.addField("** **", `Attention, sur la commande \`^filter\`.\nLe nom du filtre doit être en minuscule.`)
|
||||||
|
.setColor("ORANGE");
|
||||||
|
|
||||||
|
message.channel.send(list);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports.config = {
|
||||||
|
name: "w-filters",
|
||||||
|
aliases: []
|
||||||
|
};
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"music": ":musical_note:",
|
"music": ":musical_note:",
|
||||||
"queue": ":bar_chart:",
|
"queue": ":bar_chart:",
|
||||||
"error": ":tools:",
|
"error": ":x:",
|
||||||
"success": ":white_check_mark:"
|
"success": ":white_check_mark:"
|
||||||
}
|
}
|
||||||
|
|||||||
15
config/filters.json
Normal file
15
config/filters.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"bassboost": "Bassboost",
|
||||||
|
"8D": "8D",
|
||||||
|
"vaporwave": "Vaporwave",
|
||||||
|
"nightcore": "Nightcore",
|
||||||
|
"phaser": "Phaser",
|
||||||
|
"tremolo": "Tremolo",
|
||||||
|
"vibrato": "Vibrato",
|
||||||
|
"reverse": "Reverse",
|
||||||
|
"treble": "Reverse",
|
||||||
|
"normalizer": "Normalizer",
|
||||||
|
"surrounding": "Surrounding",
|
||||||
|
"pulsator": "Pulsator",
|
||||||
|
"superequalizer": "Superequalizer"
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
"author": "ZerioDev",
|
"author": "ZerioDev",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordjs/opus": "^0.1.0",
|
"@discordjs/opus": "^0.3.2",
|
||||||
"discord-player": "^1.4.0",
|
"discord-player": "^1.4.0",
|
||||||
"discord.js": "^12.2.0"
|
"discord.js": "^12.2.0"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user