mirror of
https://github.com/Alee14/AleeBot.git
synced 2025-01-23 19:42:04 -05:00
Uptime command (#12)
* Uptime command * Being a good boy and following instructions (lol)
This commit is contained in:
parent
96db7651f7
commit
a8fdb157a6
2 changed files with 16 additions and 1 deletions
|
@ -10,7 +10,8 @@ Get gource at: https://gource.io
|
||||||
# Contributors
|
# Contributors
|
||||||
Here's the list of people who helped me with AleeBot
|
Here's the list of people who helped me with AleeBot
|
||||||
1. Alee14
|
1. Alee14
|
||||||
2.
|
2. OfficialRain (Rain)
|
||||||
|
3.
|
||||||
|
|
||||||
**Please note if you contribute to this please put your name here.**
|
**Please note if you contribute to this please put your name here.**
|
||||||
|
|
||||||
|
|
14
src/bot.js
14
src/bot.js
|
@ -83,6 +83,20 @@ client.on("message", function(message) {
|
||||||
message.reply("**PONG!** :ping_pong: " + Math.round(client.ping) + " ms");
|
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() {
|
client.login(config.abtoken).catch(function() {
|
||||||
console.log("[X] Login failed. Please contact Alee14#9928 or email him at alee14498@gmail.com.");
|
console.log("[X] Login failed. Please contact Alee14#9928 or email him at alee14498@gmail.com.");
|
||||||
|
|
Loading…
Add table
Reference in a new issue