✨ Bug fixes & update (v5.0.0)
This commit is contained in:
@@ -54,11 +54,12 @@ All you have to do is turn on your bot !
|
||||
### 🎵 Music commands
|
||||
|
||||
```
|
||||
play <name>, play music in a voice channel.
|
||||
play <name/URL>, play music in a voice channel.
|
||||
search <name>, open a panel to choose a music and then play it.
|
||||
pause, pause the current music.
|
||||
resume, puts the current music back on.
|
||||
queue, see the next songs.
|
||||
clear-queue, delete the next music.
|
||||
clear-queue, remove music in the queue.
|
||||
shuffle, to mix the queue.
|
||||
nowplaying, see music in progress.
|
||||
loop, to enable or disable the repeat function.
|
||||
|
||||
@@ -11,6 +11,8 @@ module.exports = {
|
||||
|
||||
if (!client.player.getQueue(message)) return message.channel.send(`${client.emotes.error} - No music currently playing !`);
|
||||
|
||||
if (client.player.getQueue(message).tracks.length <= 1) return message.channel.send(`${client.emotes.error} - There is only one song in the queue.`);
|
||||
|
||||
client.player.clearQueue(message);
|
||||
|
||||
message.channel.send(`${client.emotes.success} - The queue has just been **removed** !`);
|
||||
|
||||
@@ -4,19 +4,29 @@ module.exports = {
|
||||
category: 'Music',
|
||||
utilisation: '{prefix}loop',
|
||||
|
||||
execute(client, message) {
|
||||
execute(client, message, args) {
|
||||
if (!message.member.voice.channel) return message.channel.send(`${client.emotes.error} - You're not in a voice channel !`);
|
||||
|
||||
if (message.guild.me.voice.channel && message.member.voice.channel.id !== message.guild.me.voice.channel.id) return message.channel.send(`${client.emotes.error} - You are not in the same voice channel !`);
|
||||
|
||||
if (!client.player.getQueue(message)) return message.channel.send(`${client.emotes.error} - No music currently playing !`);
|
||||
|
||||
if (args.join(" ").toLowerCase() === 'queue') {
|
||||
if (client.player.getQueue(message).loopMode) {
|
||||
client.player.setLoopMode(message, false);
|
||||
return message.channel.send(`${client.emotes.success} - Repeat mode **disabled** !`);
|
||||
} else {
|
||||
client.player.setLoopMode(message, true);
|
||||
return message.channel.send(`${client.emotes.success} - Repeat mode **enabled** the whole queue will be repeated endlessly !`);
|
||||
};
|
||||
} else {
|
||||
if (client.player.getQueue(message).repeatMode) {
|
||||
client.player.setRepeatMode(message, false);
|
||||
return message.channel.send(`${client.emotes.success} - Repeat mode **disabled** !`);
|
||||
} else {
|
||||
client.player.setRepeatMode(message, true);
|
||||
return message.channel.send(`${client.emotes.success} - Repeat mode **enabled** !`);
|
||||
return message.channel.send(`${client.emotes.success} - Repeat mode **enabled** the current music will be repeated endlessly !`);
|
||||
};
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -11,6 +11,6 @@ module.exports = {
|
||||
|
||||
if (!args[0]) return message.channel.send(`${client.emotes.error} - Please indicate the title of a song !`);
|
||||
|
||||
client.player.play(message, args.join(" "));
|
||||
client.player.play(message, args.join(" "), { firstResult: true });
|
||||
},
|
||||
};
|
||||
@@ -13,7 +13,7 @@ module.exports = {
|
||||
|
||||
if (!client.player.getQueue(message)) return message.channel.send(`${client.emotes.error} - No songs currently playing !`);
|
||||
|
||||
message.channel.send(`**Server queue - ${message.guild.name} ${client.emotes.queue}**\nCurrent : ${queue.playing.title} | ${queue.playing.author}\n\n` + (queue.tracks.map((track, i) => {
|
||||
message.channel.send(`**Server queue - ${message.guild.name} ${client.emotes.queue} ${client.player.getQueue(message).loopMode ? '(looped)' : ''}**\nCurrent : ${queue.playing.title} | ${queue.playing.author}\n\n` + (queue.tracks.map((track, i) => {
|
||||
return `**#${i + 1}** - ${track.title} | ${track.author} (requested by : ${track.requestedBy.username})`
|
||||
}).slice(0, 5).join('\n') + `\n\n${queue.tracks.length > 5 ? `And **${queue.tracks.length - 5}** other songs...` : `In the playlist **${queue.tracks.length}** song(s)...`}`));
|
||||
},
|
||||
|
||||
16
commands/music/search.js
Normal file
16
commands/music/search.js
Normal file
@@ -0,0 +1,16 @@
|
||||
module.exports = {
|
||||
name: 'search',
|
||||
aliases: ['sr'],
|
||||
category: 'Music',
|
||||
utilisation: '{prefix}search [name/URL]',
|
||||
|
||||
execute(client, message, args) {
|
||||
if (!message.member.voice.channel) return message.channel.send(`${client.emotes.error} - You're not in a voice channel !`);
|
||||
|
||||
if (message.guild.me.voice.channel && message.member.voice.channel.id !== message.guild.me.voice.channel.id) return message.channel.send(`${client.emotes.error} - You are not in the same voice channel !`);
|
||||
|
||||
if (!args[0]) return message.channel.send(`${client.emotes.error} - Please indicate the title of a song !`);
|
||||
|
||||
client.player.play(message, args.join(" "));
|
||||
},
|
||||
};
|
||||
@@ -15,7 +15,7 @@ module.exports = {
|
||||
|
||||
if (Math.round(parseInt(args[0])) < 1 || Math.round(parseInt(args[0])) > 100) return message.channel.send(`${client.emotes.error} - Please enter a valid number (between 1 and 100) !`);
|
||||
|
||||
client.player.setVolume(message, args[0]);
|
||||
client.player.setVolume(message, parseInt(args[0]));
|
||||
|
||||
message.channel.send(`${client.emotes.success} - Volume set to **${parseInt(args[0])}%** !`);
|
||||
},
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
"name": "music-bot",
|
||||
"main": "index.js",
|
||||
"author": "ZerioDev",
|
||||
"version": "4.0.2",
|
||||
"version": "5.0.0",
|
||||
"repository": "https://github.com/ZerioDev/Music-bot.git",
|
||||
"description": "A complete code to download for a music bot. Using a module (discord-player).",
|
||||
"dependencies": {
|
||||
"@discordjs/opus": "^0.3.3",
|
||||
"discord-player": "^3.0.3",
|
||||
"discord-player": "^3.2.0",
|
||||
"discord.js": "^12.5.1",
|
||||
"ffmpeg-static": "^4.2.7"
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module.exports = (client, message, playlist) => {
|
||||
message.channel.send(`${client.emotes.music} - ${playlist.title} has been added to the queue (**${playlist.items.length}** songs) !`);
|
||||
module.exports = (client, message, queue, playlist) => {
|
||||
message.channel.send(`${client.emotes.music} - ${playlist.title} has been added to the queue (**${playlist.tracks.length}** songs) !`);
|
||||
};
|
||||
@@ -1,3 +1,6 @@
|
||||
module.exports = (client, message, query, tracks, content, collector) => {
|
||||
message.channel.send(`${client.emotes.error} - You must send a valid number between **1** and **${tracks.length}** !`);
|
||||
if (content === 'cancel') {
|
||||
collector.stop();
|
||||
return message.channel.send(`${client.emotes.success} - The selection has been **cancelled** !`);
|
||||
} else message.channel.send(`${client.emotes.error} - You must send a valid number between **1** and **${tracks.length}** !`);
|
||||
};
|
||||
Reference in New Issue
Block a user