diff options
| author | Unknown <Alee14498@gmail.com> | 2017-08-17 01:40:08 -0400 |
|---|---|---|
| committer | Unknown <Alee14498@gmail.com> | 2017-08-17 01:40:08 -0400 |
| commit | 2a8c799d7a9ad46f398c5e2feb448140eecbc638 (patch) | |
| tree | 60883532c86f70a713fc3af6a8584edeb044811b /commands/uptime.js | |
| parent | a8d005f965dc66a05316db7bc723eaddbc5399ee (diff) | |
| download | AleeBot-1.1.0.tar.gz AleeBot-1.1.0.tar.bz2 AleeBot-1.1.0.zip | |
Official 1.1.0 release!v1.1.0
Changelog: New command handler!
Diffstat (limited to 'commands/uptime.js')
| -rw-r--r-- | commands/uptime.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/commands/uptime.js b/commands/uptime.js new file mode 100644 index 0000000..fd57a98 --- /dev/null +++ b/commands/uptime.js @@ -0,0 +1,41 @@ +const Discord = require('discord.js'); +exports.run = (client, message, args, config) => { +//This command was ported from AstralMod +var timeString; // What we'll eventually put into the message + +var uptime = parseInt(client.uptime); // Get uptime in ms + +uptime = Math.floor(uptime / 1000); // Convert from ms to s + +var uptimeMinutes = Math.floor(uptime / 60); // Get the uptime in minutes + +var minutes = uptime % 60; + +var hours = 0; + +while (uptimeMinutes >= 60) { + +hours++; + +uptimeMinutes = uptimeMinutes - 60; + +} + + + +if (uptimeMinutes < 10) { + +timeString = hours + ":0" + uptimeMinutes // We need to add an additional 0 to the minutes + +} else { + +timeString = hours + ":" + uptimeMinutes // We don't need to add an extra 0. + +} + + + +message.reply("AleeBot has been up for " + timeString + " hours. Looks like i'm not tired :wink:"); + +commandProcessed = true; +} |
