summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOfficialRain <ryanf0709@gmail.com>2017-10-22 18:22:50 -0700
committerAlee14 <Alee14498@gmail.com>2017-10-22 21:22:50 -0400
commita8fdb157a61612f38890d1e9f73b6d4c2b4aaac6 (patch)
tree3eb8fe4d684988904b72cbb9297953d1d145629e
parent96db7651f7aad05bec816e3fff2d00b90957081d (diff)
downloadAleeBot-a8fdb157a61612f38890d1e9f73b6d4c2b4aaac6.tar.gz
AleeBot-a8fdb157a61612f38890d1e9f73b6d4c2b4aaac6.tar.bz2
AleeBot-a8fdb157a61612f38890d1e9f73b6d4c2b4aaac6.zip
Uptime command (#12)
* Uptime command * Being a good boy and following instructions (lol)
-rw-r--r--README.md3
-rw-r--r--src/bot.js14
2 files changed, 16 insertions, 1 deletions
diff --git a/README.md b/README.md
index 4f5e878..9cd7c9b 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,8 @@ Get gource at: https://gource.io
# Contributors
Here's the list of people who helped me with AleeBot
1. Alee14
-2.
+2. OfficialRain (Rain)
+3.
**Please note if you contribute to this please put your name here.**
diff --git a/src/bot.js b/src/bot.js
index c9972e3..a3226d4 100644
--- a/src/bot.js
+++ b/src/bot.js
@@ -82,6 +82,20 @@ client.on("message", function(message) {
if (command === 'ping') {
message.reply("**PONG!** :ping_pong: " + Math.round(client.ping) + " ms");
}
+
+ if(command === 'uptime') {
+ var uptime = parseInt(client.uptime);
+ uptime = Math.floor(uptime / 1000);
+ var uptimeMinutes = Math.floor(uptime / 60);
+ var minutes = uptime % 60;
+ var hours = 0;
+ while (uptimeMinutes >= 60) {
+ hours++;
+ uptimeMinutes = uptimeMinutes - 60;
+ }
+ var uptimeSeconds = minutes % 60;
+ message.channel.send(":clock3: AleeBot has been up for " + hours + " hours, " + uptimeMinutes + " minutes, and " + uptimeSeconds + " seconds.")
+ }
});
client.login(config.abtoken).catch(function() {