93
README.md
93
README.md
@@ -10,18 +10,19 @@ For the bot to be able to start, please complete the file with your credentials
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
{
|
{
|
||||||
"prefix": "PREFIX BOT",
|
"prefix": "PREFIX",
|
||||||
|
|
||||||
|
"game": "GAME",
|
||||||
|
|
||||||
"token_bot": "TOKEN BOT",
|
"token_bot": "TOKEN"
|
||||||
"youtube_api": "TOKEN YOUTUBE API"
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Reminder :
|
Reminder :
|
||||||
|
|
||||||
- `prefix`, the prefix that will be set to use the bot.
|
- `prefix`, the prefix that will be set to use the bot.
|
||||||
|
- `game`, the status of the bot.
|
||||||
- `token_bot`, the token of the bot available on the [Discord Developers](https://discordapp.com/developers/applications) section.
|
- `token_bot`, the token of the bot available on the [Discord Developers](https://discordapp.com/developers/applications) section.
|
||||||
- `youtube_api`, your youtube token available on the [Google console](https://console.developers.google.com).
|
|
||||||
|
|
||||||
To customize the emojis go to the file `emojis.json`.
|
To customize the emojis go to the file `emojis.json`.
|
||||||
Emojis are already defined by default but you can modify them if you wish.
|
Emojis are already defined by default but you can modify them if you wish.
|
||||||
@@ -30,7 +31,7 @@ Emojis are already defined by default but you can modify them if you wish.
|
|||||||
{
|
{
|
||||||
"music": ":musical_note:",
|
"music": ":musical_note:",
|
||||||
"queue": ":bar_chart:",
|
"queue": ":bar_chart:",
|
||||||
"error": ":tools:",
|
"error": ":x:",
|
||||||
"success": ":white_check_mark:"
|
"success": ":white_check_mark:"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -38,61 +39,47 @@ Emojis are already defined by default but you can modify them if you wish.
|
|||||||
Go to the console and type this :
|
Go to the console and type this :
|
||||||
|
|
||||||
```
|
```
|
||||||
npm init
|
npm i
|
||||||
npm i (name of each missing module)
|
```
|
||||||
|
|
||||||
|
To start the bot :
|
||||||
|
|
||||||
|
```
|
||||||
|
#With Node
|
||||||
|
node index.js
|
||||||
|
|
||||||
|
#With pm2
|
||||||
|
pm2 start index.js --name "MusicBot"
|
||||||
```
|
```
|
||||||
|
|
||||||
All you have to do is turn on your bot !
|
All you have to do is turn on your bot !
|
||||||
|
|
||||||
- `play <name>`, play music in a vocal salon.
|
### 🎵 Music commands
|
||||||
- `pause`, pauses the current music.
|
|
||||||
- `resume`, puts the current music back on.
|
|
||||||
- `queue`, see the next musics.
|
|
||||||
- `clear-queue`, delete the next music.
|
|
||||||
- `now-playing`, see music in progress.
|
|
||||||
- `set-volume <...>`, change the volume.
|
|
||||||
- `set-repeat`to enable or disable the repeat function.
|
|
||||||
- `skip`, skip to next music.
|
|
||||||
- `stop`, stop all music.
|
|
||||||
|
|
||||||
|
```
|
||||||
|
play <name>, play music in a vocal salon.
|
||||||
|
pause, pause the current music.
|
||||||
|
resume, puts the current music back on.
|
||||||
|
queue, see the next musics.
|
||||||
|
np, see music in progress.
|
||||||
|
volume <1 - 100>, change the volume.
|
||||||
|
loop, to enable or disable the repeat function.
|
||||||
|
skip, skip to next music.
|
||||||
|
stop, stop all music.
|
||||||
|
filter <filter>, add / remove filters.
|
||||||
|
w-filters, see filters.
|
||||||
|
clear-queue, delete the next music.
|
||||||
|
```
|
||||||
|
|
||||||
|
### 💡 General commands
|
||||||
|
|
||||||
|
```
|
||||||
|
help, see the list of available orders.
|
||||||
|
ping, see the bot latency.
|
||||||
|
```
|
||||||
|
|
||||||
Utilities (to change the code) :
|
Utilities (to change the code) :
|
||||||
|
|
||||||
Functions available with the `discord-player` module that you can use :
|
|
||||||
|
|
||||||
```js
|
|
||||||
// Play a song in the voice channel and init the guild queue
|
|
||||||
client.player.play(voiceChannel, songName);
|
|
||||||
|
|
||||||
// Add a song to the queue
|
|
||||||
client.player.addToQueue(guildID, songName);
|
|
||||||
// Clear the queue
|
|
||||||
client.player.clearQueue(guildID);
|
|
||||||
// Get the queue
|
|
||||||
client.player.getQueue(guildID);
|
|
||||||
// Skip the current song
|
|
||||||
client.player.skip(guildID);
|
|
||||||
|
|
||||||
|
|
||||||
// Pause
|
|
||||||
client.player.pause(guildID);
|
|
||||||
// Resume
|
|
||||||
client.player.resume(guildID);
|
|
||||||
// Stop
|
|
||||||
client.player.stop(guildID);
|
|
||||||
|
|
||||||
// Check if music is playing in a guild
|
|
||||||
client.player.isPlaying(guildID);
|
|
||||||
// Get the currently playing song
|
|
||||||
client.player.nowPlaying(guildID);
|
|
||||||
|
|
||||||
|
|
||||||
// Current song will be repeated indefinitely
|
|
||||||
client.player.setRepeatMode(true);
|
|
||||||
// Current song will no longer be repeated indefinitely
|
|
||||||
client.player.setRepeatMode(false);
|
|
||||||
```
|
|
||||||
|
|
||||||
Find all the functions available on the official code [right here](https://github.com/Androz2091/discord-player).
|
Find all the functions available on the official code [right here](https://github.com/Androz2091/discord-player).
|
||||||
|
|
||||||
This is used with [Discord.js](https://www.npmjs.com/package/discord.js) and [discord-player](https://www.npmjs.com/package/discord-player).
|
This is used with [discord.js](https://www.npmjs.com/package/discord.js) and [discord-player](https://www.npmjs.com/package/discord-player).
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
const emotes = require ("../config/emojis.json");
|
const emotes = require ("../config/emojis.json");
|
||||||
|
const Discord = require("discord.js")
|
||||||
|
|
||||||
module.exports.run = async (client, message) => {
|
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 the member is not in a voice channel
|
||||||
|
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}**`);
|
//If there's no music
|
||||||
|
if(!client.player.isPlaying(message.guild.id)) return message.channel.send(`No music playing on this server ${emotes.error}`);
|
||||||
|
|
||||||
|
//The bot removes the waiting list
|
||||||
client.player.clearQueue(message.guild.id);
|
client.player.clearQueue(message.guild.id);
|
||||||
|
|
||||||
message.channel.send(`**Queue cleared ${emotes.success}**`);
|
//Success message
|
||||||
|
message.channel.send(`Queue cleared ${emotes.success}`);
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
module.exports.config = {
|
|
||||||
name: "clear-queue",
|
|
||||||
aliases: []
|
|
||||||
};
|
|
||||||
|
|||||||
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")
|
||||||
|
|
||||||
|
exports.run = async (client, message, args) => {
|
||||||
|
|
||||||
|
//If the member is not in a voice channel
|
||||||
|
if(!message.member.voice.channel) return message.channel.send(`You're not in a voice channel ${emotes.error}`);
|
||||||
|
|
||||||
|
//If there's no music
|
||||||
|
if(!client.player.isPlaying(message.guild.id)) return message.channel.send(`No music playing on this server ${emotes.error}`);
|
||||||
|
|
||||||
|
//Filter
|
||||||
|
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 he can't find the filter
|
||||||
|
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]) {
|
||||||
|
|
||||||
|
//The bot adds the filter on the music
|
||||||
|
message.channel.send(`I'm adding the filter to the music, please wait... Note : the longer the music is, the longer the wait will be ${emotes.music}`);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
//The bot removes the filter from the music
|
||||||
|
message.channel.send(`I'm disabling the filter on the music, please wait... Note : the longer the music is playing, the longer the wait will be ${emotes.music}`);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
19
commands/help.js
Normal file
19
commands/help.js
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
const config = require ("../config/bot.json");
|
||||||
|
const emotes = require ("../config/emojis.json");
|
||||||
|
const Discord = require("discord.js")
|
||||||
|
|
||||||
|
exports.run = async (client, message, args) => {
|
||||||
|
|
||||||
|
//New embed
|
||||||
|
const help = new Discord.MessageEmbed()
|
||||||
|
.setDescription("Find the list of commands available on this panel.")
|
||||||
|
.addField("**Music**", "`play`, `pause`, `resume`, `queue`, `clear-queue`, `shuffle`, `np`, `loop`, `volume`, `skip`, `stop`")
|
||||||
|
.addField("**Filters**", "`bassboost`, `tremolo`, `vibrato`, `treble`, `8D`, `normalizer`, `surrounding`, `nightcore`, `vaporwave`, `superequalizer`, `phaser`, `reverse`, `pulsator`")
|
||||||
|
.addField("**Informations**", "`ping`")
|
||||||
|
.setFooter(`To use filters, ${config.prefix}filter (the filter). Example : ${config.prefix}filter 8D.`)
|
||||||
|
.setColor("ORANGE")
|
||||||
|
|
||||||
|
//Message
|
||||||
|
message.channel.send(help)
|
||||||
|
|
||||||
|
}
|
||||||
33
commands/loop.js
Normal file
33
commands/loop.js
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
const emotes = require ("../config/emojis.json");
|
||||||
|
const Discord = require("discord.js")
|
||||||
|
|
||||||
|
exports.run = async (client, message, args) => {
|
||||||
|
|
||||||
|
//If the member is not in a voice channel
|
||||||
|
if(!message.member.voice.channel) return message.channel.send(`You're not in a voice channel ${emotes.error}`);
|
||||||
|
|
||||||
|
//If there's no music
|
||||||
|
if(!client.player.isPlaying(message.guild.id)) return message.channel.send(`No music playing on this server ${emotes.error}`);
|
||||||
|
|
||||||
|
//Repeat mode
|
||||||
|
const repeatMode = client.player.getQueue(message.guild.id).repeatMode;
|
||||||
|
|
||||||
|
//If the mode is enabled
|
||||||
|
if(repeatMode) {
|
||||||
|
|
||||||
|
client.player.setRepeatMode(message.guild.id, false);
|
||||||
|
|
||||||
|
//Message
|
||||||
|
return message.channel.send(`Repeat mode disabled ${emotes.success}`);
|
||||||
|
|
||||||
|
//If the mode is disabled
|
||||||
|
} else {
|
||||||
|
|
||||||
|
client.player.setRepeatMode(message.guild.id, true);
|
||||||
|
|
||||||
|
//Message
|
||||||
|
return message.channel.send(`Repeat mode enabled ${emotes.success}`);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
const emotes = require ("../config/emojis.json");
|
|
||||||
|
|
||||||
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 song = await client.player.nowPlaying(message.guild.id);
|
|
||||||
|
|
||||||
message.channel.send(`**Currently playing ${song.name} ${emotes.music}**`);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports.config = {
|
|
||||||
name: "now-playing",
|
|
||||||
aliases: []
|
|
||||||
};
|
|
||||||
17
commands/np.js
Normal file
17
commands/np.js
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
const emotes = require ("../config/emojis.json");
|
||||||
|
const Discord = require("discord.js")
|
||||||
|
|
||||||
|
exports.run = async (client, message, args) => {
|
||||||
|
|
||||||
|
//If the member is not in a voice channel
|
||||||
|
if(!message.member.voice.channel) return message.channel.send(`You're not in a voice channel ${emotes.error}`);
|
||||||
|
|
||||||
|
//If there's no music
|
||||||
|
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);
|
||||||
|
|
||||||
|
//Message
|
||||||
|
message.channel.send(`Currently playing ${song.name} ${emotes.music}\nProgression : [${client.player.createProgressBar(message.guild.id)}]`);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,20 +1,17 @@
|
|||||||
|
const emotes = require ("../config/emojis.json");
|
||||||
const Discord = require("discord.js")
|
const Discord = require("discord.js")
|
||||||
const fs = require("fs")
|
|
||||||
const emotes = require ("../config/emojis.json")
|
|
||||||
|
|
||||||
module.exports.run = async (client, message) => {
|
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 the member is not in a voice channel
|
||||||
|
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}**`);
|
//If there's no music
|
||||||
|
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
|
||||||
|
message.channel.send(`Song ${track.name} paused ${emotes.success}`);
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
module.exports.config = {
|
|
||||||
name: "pause",
|
|
||||||
aliases: []
|
|
||||||
}
|
|
||||||
|
|||||||
9
commands/ping.js
Normal file
9
commands/ping.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
const emotes = require ("../config/emojis.json");
|
||||||
|
const Discord = require("discord.js")
|
||||||
|
|
||||||
|
exports.run = async (client, message, args) => {
|
||||||
|
|
||||||
|
//Message
|
||||||
|
message.channel.send(`Ping : ${client.ws.ping} ms ${emotes.success}`)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,27 +1,52 @@
|
|||||||
const emotes = require ("../config/emojis.json");
|
const emotes = require ("../config/emojis.json");
|
||||||
|
const Discord = require("discord.js")
|
||||||
|
|
||||||
module.exports.run = async (client, message, args) => {
|
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 the member is not in a voice channel
|
||||||
|
if(!message.member.voice.channel) return message.channel.send(`You're not in a voice channel ${emotes.error}`);
|
||||||
|
|
||||||
if (!args[0]) return message.channel.send(`**Please enter a music ${emotes.error}**`);
|
//If no music is provided
|
||||||
|
if (!args[0]) return message.channel.send(`Please enter a music ${emotes.error}`);
|
||||||
const aSongIsAlreadyPlaying = client.player.isPlaying(message.guild.id);
|
|
||||||
|
|
||||||
// If there's already a song playing
|
const aTrackIsAlreadyPlaying = client.player.isPlaying(message.guild.id);
|
||||||
if(aSongIsAlreadyPlaying){
|
|
||||||
// Add the song to the queue
|
// If there's already a track playing
|
||||||
const song = await client.player.addToQueue(message.guild.id, args.join(" "));
|
if(aTrackIsAlreadyPlaying){
|
||||||
message.channel.send(`**Song ${song.name} added to queue ${emotes.music}**`);
|
|
||||||
} else {
|
// Add the track to the queue
|
||||||
// Else, play the song
|
const result = await client.player.addToQueue(message.guild.id, args[0]);
|
||||||
const song = await client.player.play(message.member.voice.channel, args.join(" "));
|
if(!result) return message.channel.send(`This song provider is not supported...`);
|
||||||
message.channel.send(`**Currently playing ${song.name} ${emotes.music}**`);
|
|
||||||
|
if(result.type === 'playlist'){
|
||||||
|
message.channel.send(`${result.tracks.length} songs added to the queue ${emotes.music}`);
|
||||||
|
} else {
|
||||||
|
message.channel.send(`${result.name} added to the queue ${emotes.music}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Else, play the song
|
||||||
|
const result = await client.player.play(message.member.voice.channel, args.join(" ")).catch(() => {});
|
||||||
|
if(!result) return message.channel.send(`This song provider is not supported...`);
|
||||||
|
|
||||||
|
if(result.type === 'playlist'){
|
||||||
|
message.channel.send(`${result.tracks.length} songs added to the queue ${emotes.music}\nCurrently playing ${result.tracks[0].name} !`);
|
||||||
|
} else {
|
||||||
|
message.channel.send(`Currently playing ${result.name} ${emotes.music}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const queue = client.player.getQueue(message.guild.id)
|
||||||
|
|
||||||
|
//Events
|
||||||
|
.on('end', () => {
|
||||||
|
message.channel.send(`There is no more music in the queue ${emotes.error}`);
|
||||||
|
})
|
||||||
|
.on('trackChanged', (oldTrack, newTrack) => {
|
||||||
|
message.channel.send(`Now playing ${newTrack.name} ... ${emotes.music}`);
|
||||||
|
})
|
||||||
|
.on('channelEmpty', () => {
|
||||||
|
message.channel.send(`Stop playing, there is no more member in the voice channel ${emotes.error}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
module.exports.config = {
|
|
||||||
name: "play",
|
|
||||||
aliases: []
|
|
||||||
};
|
|
||||||
@@ -1,21 +1,23 @@
|
|||||||
const emotes = require ("../config/emojis.json");
|
const emotes = require ("../config/emojis.json");
|
||||||
|
const Discord = require("discord.js")
|
||||||
|
|
||||||
module.exports.run = async (client, message) => {
|
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 the member is not in a voice channel
|
||||||
|
if(!message.member.voice.channel) return message.channel.send(`You're not in a voice channel ${emotes.error}`);
|
||||||
|
|
||||||
|
//Get queue
|
||||||
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 there's no music
|
||||||
|
if(!queue) return message.channel.send(`No songs currently playing ${emotes.error}`);
|
||||||
|
|
||||||
message.channel.send(`**Server queue ${emotes.queue}** \n`+(queue.songs.map((song, i) => {
|
//Message
|
||||||
return `${i === 0 ? 'Current' : `#${i+1}`} - ${song.name} | ${song.author}`
|
message.channel.send(`**Server queue ${emotes.queue}**\nCurrent - ${queue.playing.name} | ${queue.playing.author}\n`+
|
||||||
}).join('\n')));
|
(
|
||||||
|
queue.tracks.map((track, i) => {
|
||||||
|
return `#${i+1} - ${track.name} | ${track.author}`
|
||||||
|
}).join('\n')
|
||||||
|
));
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
module.exports.config = {
|
|
||||||
name: "queue",
|
|
||||||
aliases: []
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
const emotes = require ("../config/emojis.json");
|
const emotes = require ("../config/emojis.json");
|
||||||
|
const Discord = require("discord.js")
|
||||||
|
|
||||||
module.exports.run = async (client, message) => {
|
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 the member is not in a voice channel
|
||||||
|
if(!message.member.voice.channel) return message.channel.send(`You're not in a voice channel ${emotes.error}`);
|
||||||
|
|
||||||
|
//Get song
|
||||||
const song = await client.player.resume(message.guild.id);
|
const song = await client.player.resume(message.guild.id);
|
||||||
|
|
||||||
if(!song) return message.channel.send(`**No songs currently playing ${emotes.error}**`);
|
//If there's no music
|
||||||
|
if(!song) return message.channel.send(`No songs currently playing ${emotes.error}`);
|
||||||
|
|
||||||
message.channel.send(`**Song ${song.name} resumed ${emotes.success}**`);
|
//Message
|
||||||
|
message.channel.send(`Song ${song.name} resumed ${emotes.success}`);
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
module.exports.config = {
|
|
||||||
name: "resume",
|
|
||||||
aliases: []
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
const emotes = require ("../config/emojis.json");
|
|
||||||
|
|
||||||
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 repeatMode = client.player.getQueue(message.guild.id).repeatMode;
|
|
||||||
|
|
||||||
if(repeatMode){
|
|
||||||
client.player.setRepeatMode(message.guild.id, false);
|
|
||||||
return message.channel.send(`**Repeat mode disabled ${emotes.success}**`);
|
|
||||||
} else {
|
|
||||||
client.player.setRepeatMode(message.guild.id, true);
|
|
||||||
return message.channel.send(`**Repeat mode enabled ${emotes.success}**`);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports.config = {
|
|
||||||
name: "set-repeat",
|
|
||||||
aliases: []
|
|
||||||
};
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
const emotes = require ("../config/emojis.json");
|
|
||||||
|
|
||||||
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}**`);
|
|
||||||
if(!args[0]) return message.channel.send(`**Please enter a number ${emotes.error}**`);
|
|
||||||
if(isNaN(args[0])) return message.channel.send(`**Please enter a valid number ${emotes.error}**`);
|
|
||||||
|
|
||||||
client.player.setVolume(message.guild.id, parseInt(args.join(" ")));
|
|
||||||
|
|
||||||
message.channel.send("**Volume set to** `" + args.join(" ") + "`" + `** ** ${emotes.success}`);
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports.config = {
|
|
||||||
name: "set-volume",
|
|
||||||
aliases: []
|
|
||||||
};
|
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
const emotes = require ("../config/emojis.json");
|
const emotes = require ("../config/emojis.json");
|
||||||
|
const Discord = require("discord.js")
|
||||||
|
|
||||||
module.exports.run = async (client, message) => {
|
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 the member is not in a voice channel
|
||||||
|
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}**`);
|
//If there's no music
|
||||||
|
if(!client.player.isPlaying(message.guild.id)) return message.channel.send(`No music playing on this server ${emotes.error}`);
|
||||||
|
|
||||||
client.player.shuffle(message.guild.id);
|
client.player.shuffle(message.guild.id);
|
||||||
return message.channel.send(`**Queue shuffled ${emotes.success}**`);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports.config = {
|
//Message
|
||||||
name: "shuffle",
|
return message.channel.send(`Queue shuffled ${emotes.success}`);
|
||||||
aliases: []
|
|
||||||
};
|
}
|
||||||
|
|||||||
@@ -1,18 +1,17 @@
|
|||||||
const emotes = require ("../config/emojis.json");
|
const emotes = require ("../config/emojis.json");
|
||||||
|
const Discord = require("discord.js")
|
||||||
|
|
||||||
module.exports.run = async (client, message) => {
|
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 the member is not in a voice channel
|
||||||
|
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}**`);
|
//If there's no music
|
||||||
|
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
|
||||||
|
message.channel.send(`Song ${track.name} skipped ${emotes.success}`);
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
module.exports.config = {
|
|
||||||
name: "skip",
|
|
||||||
aliases: []
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
const emotes = require ("../config/emojis.json");
|
const emotes = require ("../config/emojis.json");
|
||||||
|
const Discord = require("discord.js")
|
||||||
|
|
||||||
module.exports.run = async (client, message) => {
|
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 the member is not in a voice channel
|
||||||
|
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}**`);
|
//If there's no music
|
||||||
|
if(!client.player.isPlaying(message.guild.id)) return message.channel.send(`No music playing on this server ${emotes.error}`);
|
||||||
|
|
||||||
|
//Stop player
|
||||||
client.player.stop(message.guild.id);
|
client.player.stop(message.guild.id);
|
||||||
|
|
||||||
message.channel.send(`**Music stopped ${emotes.success}**`);
|
//Message
|
||||||
|
message.channel.send(`Music stopped ${emotes.success}`);
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
module.exports.config = {
|
|
||||||
name: "stop",
|
|
||||||
aliases: []
|
|
||||||
};
|
|
||||||
|
|||||||
32
commands/volume.js
Normal file
32
commands/volume.js
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
const emotes = require ("../config/emojis.json");
|
||||||
|
const Discord = require("discord.js")
|
||||||
|
|
||||||
|
exports.run = async (client, message, args) => {
|
||||||
|
|
||||||
|
//If the member is not in a voice channel
|
||||||
|
if(!message.member.voice.channel) return message.channel.send(`You're not in a voice channel ${emotes.error}`);
|
||||||
|
|
||||||
|
//If there's no music
|
||||||
|
if(!client.player.isPlaying(message.guild.id)) return message.channel.send(`No music playing on this server ${emotes.error}`);
|
||||||
|
|
||||||
|
//Args
|
||||||
|
if(!args[0]) return message.channel.send(`Please enter a number ${emotes.error}`);
|
||||||
|
|
||||||
|
//Security modification
|
||||||
|
if(isNaN(args[0])) return message.channel.send(`Please enter a valid number ${emotes.error}`);
|
||||||
|
if(100 < args[0]) return message.channel.send(`Please enter a valid number ${emotes.error}`)
|
||||||
|
if(args[0] <=0) return message.channel.send(`Please enter a valid number ${emotes.error}`)
|
||||||
|
|
||||||
|
//Cannot put (-), (+), (,) or (.)
|
||||||
|
if(message.content.includes("-")) return message.channel.send(`Please enter a valid number ${emotes.error}`)
|
||||||
|
if(message.content.includes("+")) return message.channel.send(`Please enter a valid number ${emotes.error}`)
|
||||||
|
if(message.content.includes(",")) return message.channel.send(`Please enter a valid number ${emotes.error}`)
|
||||||
|
if(message.content.includes(".")) return message.channel.send(`Please enter a valid number ${emotes.error}`)
|
||||||
|
|
||||||
|
//Set volume
|
||||||
|
client.player.setVolume(message.guild.id, parseInt(args.join(" ")));
|
||||||
|
|
||||||
|
//Message
|
||||||
|
message.channel.send(`Volume set to \`${args.join(" ")}\` ${emotes.success}`);
|
||||||
|
|
||||||
|
}
|
||||||
35
commands/w-filters.js
Normal file
35
commands/w-filters.js
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
const config = require ("../config/bot.json");
|
||||||
|
const emotes = require ("../config/emojis.json");
|
||||||
|
const filters = require ("../config/filters.json");
|
||||||
|
const Discord = require("discord.js")
|
||||||
|
|
||||||
|
exports.run = async (client, message, args) => {
|
||||||
|
|
||||||
|
//If the member is not in a voice channel
|
||||||
|
if(!message.member.voice.channel) return message.channel.send(`You're not in a voice channel ${emotes.error}`);
|
||||||
|
|
||||||
|
//If there's no music
|
||||||
|
if(!client.player.isPlaying(message.guild.id)) return message.channel.send(`No music playing on this server ${emotes.error}`);
|
||||||
|
|
||||||
|
//Emojis
|
||||||
|
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));
|
||||||
|
});
|
||||||
|
|
||||||
|
//List embed
|
||||||
|
const list = new Discord.MessageEmbed()
|
||||||
|
.setDescription(`List of all filters enabled or disabled.\nTo add a filter to a \`${config.prefix}filter\` music.`)
|
||||||
|
.addField("**Filters**", filtersStatuses[0].join('\n'), true)
|
||||||
|
.addField("** **", filtersStatuses[1].join('\n'), true)
|
||||||
|
.setColor("ORANGE");
|
||||||
|
|
||||||
|
//Message
|
||||||
|
message.channel.send(list);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"prefix": "PREFIX BOT",
|
"prefix": "PREFIX",
|
||||||
|
|
||||||
|
"game": "GAME",
|
||||||
|
|
||||||
"token_bot": "TOKEN BOT",
|
"token_bot": "TOKEN"
|
||||||
"youtube_api": "TOKEN YOUTUBE API"
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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": "Treble",
|
||||||
|
"normalizer": "Normalizer",
|
||||||
|
"surrounding": "Surrounding",
|
||||||
|
"pulsator": "Pulsator",
|
||||||
|
"superequalizer": "Superequalizer"
|
||||||
|
}
|
||||||
27
events/message.js
Normal file
27
events/message.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
const config = require(`../config/bot.json`)
|
||||||
|
|
||||||
|
module.exports = (client, message) => {
|
||||||
|
|
||||||
|
//Ignore all bots
|
||||||
|
if (message.author.bot) return;
|
||||||
|
|
||||||
|
//Prefix
|
||||||
|
let prefix = config.prefix
|
||||||
|
|
||||||
|
//Ignore messages not starting with the prefix (in config.json)
|
||||||
|
if (message.content.indexOf(prefix) !== 0) return;
|
||||||
|
|
||||||
|
//Our standard argument/command name definition.
|
||||||
|
const args = message.content.slice(prefix.length).trim().split(/ +/g);
|
||||||
|
const command = args.shift().toLowerCase();
|
||||||
|
|
||||||
|
//Grab the command data from the client.commands Enmap
|
||||||
|
const cmd = client.commands.get(command);
|
||||||
|
|
||||||
|
//If that command doesn't exist, silently exit and do nothing
|
||||||
|
if (!cmd) return;
|
||||||
|
|
||||||
|
//Run the command
|
||||||
|
cmd.run(client, message, args);
|
||||||
|
|
||||||
|
};
|
||||||
11
events/ready.js
Normal file
11
events/ready.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
const config = require(`../config/bot.json`)
|
||||||
|
|
||||||
|
module.exports = async (client) => {
|
||||||
|
|
||||||
|
//If the bot is ready it sends a message in the console
|
||||||
|
console.log(`Ready on ${client.guilds.cache.size} servers, for a total of ${client.users.cache.size} users`);
|
||||||
|
|
||||||
|
//Game
|
||||||
|
client.user.setActivity(config.game)
|
||||||
|
|
||||||
|
}
|
||||||
84
index.js
84
index.js
@@ -1,59 +1,45 @@
|
|||||||
|
//Modules
|
||||||
const Discord = require("discord.js");
|
const Discord = require("discord.js");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
|
|
||||||
|
//New client
|
||||||
const client = new Discord.Client();
|
const client = new Discord.Client();
|
||||||
|
|
||||||
const settings = require ("./config/bot.json") // The bot connects using the configuration file
|
//The bot connects using the configuration file
|
||||||
|
const settings = require ("./config/bot.json")
|
||||||
|
|
||||||
const { Player } = require("discord-player"); // Create a new Player (Youtube API key is your Youtube Data v3 key)
|
//Create a new Player
|
||||||
|
const { Player } = require("discord-player")
|
||||||
const player = new Player(client, settings.youtube_api); // To easily access the player
|
|
||||||
|
|
||||||
|
//To easily access the player
|
||||||
|
const player = new Player(client)
|
||||||
client.player = player;
|
client.player = player;
|
||||||
|
|
||||||
client.on("ready", () => {
|
//Events
|
||||||
|
fs.readdir("./events/", (err, files) => {
|
||||||
console.log("The bot is ready to play music"); // If the bot is ready it sends a message in the console
|
if (err) return console.error(err);
|
||||||
|
files.forEach(file => {
|
||||||
});
|
const event = require(`./events/${file}`);
|
||||||
|
let eventName = file.split(".")[0];
|
||||||
client.login(settings.token_bot); //The bot connects thanks to the token
|
console.log(`Loading event ${eventName}`);
|
||||||
|
client.on(eventName, event.bind(null, client));
|
||||||
client.on('message', async (message) => {
|
|
||||||
|
|
||||||
const prefix = settings.prefix;
|
|
||||||
|
|
||||||
const messageArray = message.content.split(" ");
|
|
||||||
const cmd = messageArray[0].toLowerCase();
|
|
||||||
const args = messageArray.slice(1);
|
|
||||||
|
|
||||||
if(!message.content.startsWith(prefix)) return;
|
|
||||||
const commandfile = client.commands.get(cmd.slice(prefix.length)) || client.commands.get(client.aliases.get(cmd.slice(prefix.length)))
|
|
||||||
if(commandfile) commandfile.run(client,message,args)
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
client.commands = new Discord.Collection();
|
|
||||||
client.aliases = new Discord.Collection();
|
|
||||||
|
|
||||||
fs.readdir("./commands/", (err, files) => {
|
|
||||||
|
|
||||||
const jsfiles = files.filter(f => f.split(".").pop() === "js")
|
|
||||||
|
|
||||||
if(jsfiles.length <= 0) {
|
|
||||||
return console.log("Couldn't find any commands!");
|
|
||||||
}
|
|
||||||
|
|
||||||
jsfiles.forEach((file) => {
|
|
||||||
|
|
||||||
console.log(`Loading command ${file}`);
|
|
||||||
|
|
||||||
const command = require(`./commands/${file}`);
|
|
||||||
|
|
||||||
client.commands.set(command.config.name, command);
|
|
||||||
command.config.aliases.forEach(alias => {
|
|
||||||
client.aliases.set(alias, command.config.name);
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//New commands
|
||||||
|
client.commands = new Discord.Collection();
|
||||||
|
|
||||||
|
//Commands
|
||||||
|
fs.readdir("./commands/", (err, files) => {
|
||||||
|
if (err) return console.error(err);
|
||||||
|
files.forEach(file => {
|
||||||
|
if (!file.endsWith(".js")) return;
|
||||||
|
let props = require(`./commands/${file}`);
|
||||||
|
let commandName = file.split(".")[0];
|
||||||
|
console.log(`Loading command ${commandName}`);
|
||||||
|
client.commands.set(commandName, props);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
//Login
|
||||||
|
client.login(settings.token_bot);
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
"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": "github:Androz2091/discord-player#develop",
|
||||||
"discord.js": "^12.2.0"
|
"discord.js": "^12.2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user