diff options
| author | Alee14 <Alee14498@gmail.com> | 2017-08-11 16:08:16 -0400 |
|---|---|---|
| committer | Alee14 <Alee14498@gmail.com> | 2017-08-11 16:08:16 -0400 |
| commit | 4123cf8e02317466ccd08ca66b876cacbe32221a (patch) | |
| tree | dec83e1b762d52292f2fe1bb8c9dfba3794bdc07 /aleebot.js | |
| parent | cc25357d66b95d7d23468257d6cd166aa1b2e3cd (diff) | |
| download | AleeBot-4123cf8e02317466ccd08ca66b876cacbe32221a.tar.gz AleeBot-4123cf8e02317466ccd08ca66b876cacbe32221a.tar.bz2 AleeBot-4123cf8e02317466ccd08ca66b876cacbe32221a.zip | |
Adding a new command
Diffstat (limited to 'aleebot.js')
| -rw-r--r-- | aleebot.js | 41 |
1 files changed, 41 insertions, 0 deletions
@@ -92,6 +92,7 @@ client.on("message", function(message){ "**"+prefix+"ping** Type this command and you'll see ;).\n" + '**'+prefix+'owner** Shows who made this bot.\n' + '**'+prefix+'suggest** You suggest things (working progress).\n' + + '**'+prefix+'uptime** It tells you how long AleeBot has been on for.\n' + '**'+prefix+'userinfo** Tells you your info about you.\n' + '**'+prefix+'botinvite** Lets you bring AleeBot to your server.\n' + '**'+prefix+'serverinvite** Invites you to the AleeArmy Server.\n' + @@ -122,6 +123,46 @@ client.on("message", function(message){ message.reply('Sorry this feature is still being worked on :('); } + if(command === 'uptime'){ + 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(":clock1: AleeBot has been up for " + timeString + " hours."); + +commandProcessed = true; + } + if(command === 'userinfo'){ var embed = new Discord.RichEmbed() .setAuthor(message.author.username) |
