From be983da646216ca7749c222004ba2440e08445dd Mon Sep 17 00:00:00 2001 From: loicbersier Date: Wed, 17 Jun 2020 15:22:31 +0200 Subject: [PATCH] fix timestamp error --- event/listeners/ready.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/event/listeners/ready.js b/event/listeners/ready.js index 667ca71c..b701e531 100644 --- a/event/listeners/ready.js +++ b/event/listeners/ready.js @@ -61,10 +61,13 @@ class ReadyListener extends Listener { console.log('Status type: \x1b[32mCopying owner status\x1b[0m'); // Get elapsed time from when the activity started let diffMins = 0; - if (owner.presence.activities[0].timestamps) { - let diffMs = (new Date() - owner.presence.activities[0].timestamps.start); - diffMins = Math.round(((diffMs % 86400000) % 3600000) / 60000); + if (owner.presence.activities[0]) { + if (owner.presence.activities[0].timestamps) { + let diffMs = (new Date() - owner.presence.activities[0].timestamps.start); + diffMins = Math.round(((diffMs % 86400000) % 3600000) / 60000); + } } + client.user.setActivity(`${owner.presence.activities[0].name}\nfor ${diffMins} minutes | My prefix is: ${prefix[0]}`, owner.presence.activities[0]); } }