diff options
| author | Alee <alee14498@gmail.com> | 2018-04-22 16:03:43 -0400 |
|---|---|---|
| committer | Alee <alee14498@gmail.com> | 2018-04-22 16:03:43 -0400 |
| commit | 82c3dd07c299c0d89a0184a588056ecd63fcd910 (patch) | |
| tree | 5bdc74f19cd94d590bd19f8da0ef8ed74a0b4709 | |
| parent | faf97ae90c5244ac0baf58d879ca76adf517014d (diff) | |
| download | AleeBot-82c3dd07c299c0d89a0184a588056ecd63fcd910.tar.gz AleeBot-82c3dd07c299c0d89a0184a588056ecd63fcd910.tar.bz2 AleeBot-82c3dd07c299c0d89a0184a588056ecd63fcd910.zip | |
Uptime for console!
| -rw-r--r-- | bot_discord.js | 19 | ||||
| -rw-r--r-- | commands/uptime.js | 2 |
2 files changed, 16 insertions, 5 deletions
diff --git a/bot_discord.js b/bot_discord.js index 8eab9ef..b4cb86d 100644 --- a/bot_discord.js +++ b/bot_discord.js @@ -107,7 +107,7 @@ rl.on('line', function(cmd){ break;
case "broadcast":
if (!args[1]) {
- console.log('[!] Please insert the guild\'s ID.');
+ console.log('[!] Usage: broadcast [guildID] [channelID].');
} else {
let broadcast = args.join(" ").slice(48);
var guild = null;
@@ -117,11 +117,21 @@ rl.on('line', function(cmd){ if (channel != null) {
channel.send(broadcast);
}
- if (channel = null) {
- console.log ('Usage: broadcast [guildID] [channelID]')
- }
}
break;
+ case "uptime":
+ let uptime = parseInt(client.uptime);
+ uptime = Math.floor(uptime / 1000);
+ let uptimeMinutes = Math.floor(uptime / 60);
+ const minutes = uptime % 60;
+ let hours = 0;
+ while (uptimeMinutes >= 60) {
+ hours++;
+ uptimeMinutes = uptimeMinutes - 60;
+ }
+ const uptimeSeconds = minutes % 60;
+ console.log('[i] AleeBot has been up for ' + hours + ' hours, ' + uptimeMinutes + ' minutes, and ' + uptimeSeconds + ' seconds.');
+ break;
case "exit":
console.log('[i] AleeBot will now exit!')
process.exit(0);
@@ -131,6 +141,7 @@ rl.on('line', function(cmd){ msg += (`guilds - Shows all guilds that AleeBot's on.\n`)
msg += (`leave - Leaves a guild.\n`)
msg += (`broadcast - Broadcasts a message to a server.\n`)
+ msg += (`uptime - Shows the uptime for AleeBot.\n`)
msg += (`help - Shows this command.\n`)
msg += (`exit - Exits AleeBot.\n`)
console.log(msg);
diff --git a/commands/uptime.js b/commands/uptime.js index 3c0e7b4..27ccfe2 100644 --- a/commands/uptime.js +++ b/commands/uptime.js @@ -1,6 +1,6 @@ /****************************************
*
- * Purge: Command for AleeBot
+ * Uptime: Command for AleeBot
* Copyright (C) 2018 AleeCorp
*
* This program is free software: you can redistribute it and/or modify
|
