From 8c037a2b9a73d89d5e909f8e41dfba58e9c75690 Mon Sep 17 00:00:00 2001 From: MatteZ02 <47610069+MatteZ02@users.noreply.github.com> Date: Sat, 3 Aug 2019 10:19:32 +0300 Subject: [PATCH] Format update --- commands/q.js | 7 ++++++- commands/queue.js | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/commands/q.js b/commands/q.js index 0f1ab1ba..4fe98597 100644 --- a/commands/q.js +++ b/commands/q.js @@ -5,8 +5,13 @@ module.exports = { async execute(message, args, client, RichEmbed) { const serverQueue = client.queue.get(message.guild.id); if (!serverQueue) return message.channel.send(':x: There is nothing playing.'); + if (args[1]) { + if (isNaN(args[1])) return msg.channel.send(':x: I\'m sorry, But you need to enter a valid __number__.'); + } let page = parseInt(args[1]); if (!page) page = 1; + let pagetext = `:page_facing_up: Page: ${page} :page_facing_up:` + if (page === 1) pagetext = ':arrow_down: Next in queue :arrow_down:' let queuesongs = serverQueue.songs.slice((page - 1) * 20 + 1, page * 20 + 1); let queuemessage = `${queuesongs.map(song => `**#** ${song.title}`).join('\n')}` if (queuemessage.length >= 1972) { @@ -22,7 +27,7 @@ module.exports = { } const embed = new RichEmbed() .setTitle("__Song queue__") - .setDescription(`**Now playing:** ${serverQueue.songs[0].title}🎶\n:arrow_down: Next in queue :arrow_down:\n${queuemessage}`) + .setDescription(`**Now playing:** ${serverQueue.songs[0].title}🎶\n${pagetext}\n${queuemessage}`) .setColor("#b50002") return message.channel.send(embed); } diff --git a/commands/queue.js b/commands/queue.js index c043aeec..035324d8 100644 --- a/commands/queue.js +++ b/commands/queue.js @@ -5,8 +5,13 @@ module.exports = { async execute(message, args, client, RichEmbed) { const serverQueue = client.queue.get(message.guild.id); if (!serverQueue) return message.channel.send(':x: There is nothing playing.'); + if (args[1]) { + if (isNaN(args[1])) return msg.channel.send(':x: I\'m sorry, But you need to enter a valid __number__.'); + } let page = parseInt(args[1]); if (!page) page = 1; + let pagetext = `:page_facing_up: Page: ${page} :page_facing_up:` + if (page === 1) pagetext = ':arrow_down: Next in queue :arrow_down:' let queuesongs = serverQueue.songs.slice((page - 1) * 20 + 1, page * 20 + 1); let queuemessage = `${queuesongs.map(song => `**#** ${song.title}`).join('\n')}` if (queuemessage.length >= 1972) { @@ -22,7 +27,7 @@ module.exports = { } const embed = new RichEmbed() .setTitle("__Song queue__") - .setDescription(`**Now playing:** ${serverQueue.songs[0].title}🎶\n:arrow_down: Next in queue :arrow_down:\n${queuemessage}`) + .setDescription(`**Now playing:** ${serverQueue.songs[0].title}🎶\n${pagetext}\n${queuemessage}`) .setColor("#b50002") return message.channel.send(embed); }