From e3b3178a5fa03c93312f7e4c6b7bad11a4867664 Mon Sep 17 00:00:00 2001 From: MatteZ02 <47610069+MatteZ02@users.noreply.github.com> Date: Thu, 18 Jul 2019 20:29:54 +0300 Subject: [PATCH] Update index.js --- index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/index.js b/index.js index 451f4f4c..dd4ba7e6 100644 --- a/index.js +++ b/index.js @@ -379,4 +379,27 @@ function play(guild, song) { serverQueue.textChannel.send(`:musical_note: Start playing: **${song.title}**`); } +function parseDate(ms, times) { + var d = new Date(ms); + var obj = {}; + for (var i = 0; i < times.length; i++) { + if (times[i] === 'ms') { + obj[times[i]] = d.getMilliseconds(); + } else if (times[i] === 's') { + obj[times[i]] = d.getSeconds(); + } else if (times[i] === 'm') { + obj[times[i]] = d.getMinutes(); + } else if (times[i] === 'h') { + obj[times[i]] = d.getHours(); + } else if (times[i] === 'd') { + obj[times[i]] = d.getDate(); + } else if (times[i] === 'mo') { + obj[times[i]] = d.getMonth(); + } else if (times[i] === 'y') { + obj[times[i]] = d.getFullYear() - 1970; + } + } + return obj; +} + client.login(process.env.BOT_TOKEN);