add music queue command and beautify nowplaying

This commit is contained in:
ChomeNS 2022-11-09 19:33:01 +07:00
parent a80298567f
commit ecaf7900e6

View file

@ -133,7 +133,7 @@ module.exports = {
description: 'Plays music', description: 'Plays music',
alias: [], alias: [],
trusted: 0, trusted: 0,
usage: '<play|playurl|stop|loop|list|skip|loop|nowplaying> <song|all|current|off>', usage: '<play|playurl|stop|loop|list|skip|loop|nowplaying|queue> <song|all|current|off>',
execute: function(bot, username, usernameraw, sender, prefix, args) { execute: function(bot, username, usernameraw, sender, prefix, args) {
if (args[0] === 'play') { if (args[0] === 'play') {
play(bot, args.slice(1)); play(bot, args.slice(1));
@ -169,7 +169,28 @@ module.exports = {
} else if (args[0] === 'list') { } else if (args[0] === 'list') {
list(bot, false, null, prefix); list(bot, false, null, prefix);
} else if (args[0] === 'nowplaying') { } else if (args[0] === 'nowplaying') {
bot.tellraw('@a', [{text: 'Now playing '}, {text: bot.music.song.name, color: 'gold'}]); bot.tellraw('@a', [
{
text: 'Now playing ',
},
{
text: bot.music.song.name,
color: 'gold',
},
]);
} else if (args[0] === 'queue') {
const queueWithName = [];
bot.music.queue.forEach((song) => queueWithName.push(song.name));
bot.tellraw('@a', [
{
text: 'Queue: ',
color: 'green',
},
{
text: queueWithName.join(', '),
color: 'aqua',
},
]);
} else { } else {
throw new SyntaxError('Invalid argument'); throw new SyntaxError('Invalid argument');
} }