aboutsummaryrefslogtreecommitdiff
path: root/commands/uptime.js
blob: dc61369c9f1f39b998e559f9cb205e0b720f9ac6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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("It looks like AleeBot has been up for " + timeString + " hours.");

commandProcessed = true;
}

exports.conf = {
  enabled: true,

  guildOnly: false,

  aliases: [],

  permLevel: 0

};

exports.help = {

  name: 'uptime',

  description: 'It will tell you how long AleeBot has been on for.',

  usage: 'uptime'

};