Simp-O-Matic

Dumb Discord bot in TS.
git clone git://git.knutsen.co/Simp-O-Matic
Log | Files | Refs | README | LICENSE

commit 21807edb3e023ef2cb77f51079f20455bc2af6ab
parent 025087c876267f27d93cb29360c64e579129bce1
Author: Demonstrandum <moi@knutsen.co>
Date:   Sun, 22 Mar 2020 22:21:58 +0000

Merge branch 'master' of github.com:Demonstrandum/Simp-O-Matic

Diffstat:
MHELP.md | 2+-
MREADME.md | 2+-
Alib/commands/uptime.ts | 29+++++++++++++++++++++++++++++
Alib/resources/banners/banner-1280x640.jpg | 0
Alib/resources/banners/banner-FFFFFF.png | 0
Rlib/resources/banner.png -> lib/resources/banners/banner.png | 0
Mtsconfig.json | 2+-
7 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/HELP.md b/HELP.md @@ -30,7 +30,7 @@ - `!id <who>` — Print ID of user, or self if no-one is specified. - `!get [accessor]` — Get a runtime configuration variable, using JavaScript object dot-notation. - `!set [accessor] [json-value]` — Set a value in the runtime JavaScript configuration object. -- `!uptime` **〈not impl.〉** — Display how long the bot has been running for. +- `!uptime` — Display how long the bot has been running for. - `!clear #[number-of-messages] <@user-name>` **〈not impl.〉** — Clear a number of messages, from latest sent in the current channel. Will delete any recent messages, unless a specific username is provided, in which case it will only clear messages sent from that user. - `!alias` — Manage aliases to commands: - **Have a look at the aliases list, for alternatives to long commands!** diff --git a/README.md b/README.md @@ -1,7 +1,7 @@ # The Simp'O'Matic <p align="center"> - <img width="300" src="lib/resources/banner.png"> + <img width="300" src="lib/resources/banners/banner-FFFFFF.png"> </p> ## Help Out diff --git a/lib/commands/uptime.ts b/lib/commands/uptime.ts @@ -0,0 +1,29 @@ +import { FORMATS } from '../extensions'; + +export default (home_scope : HomeScope) => { + const { message } = home_scope; + + const { uptime } = message.client; + let seconds = uptime / 1000; + + const [days, hours] = [ + Math.floor(seconds / 86400), + Math.floor(seconds / 3600) + ]; + + seconds %= 3600; + + const [mins, secs] = [ + Math.floor(seconds / 60), + seconds % 60 + ]; + + message.channel.send( + `I've been running for: ` + + (`${days} days, ` + + `${hours} hours, ` + + `${mins} minutes and ` + + `${secs} seconds.` + ).format(FORMATS.bold) + ); +}; diff --git a/lib/resources/banners/banner-1280x640.jpg b/lib/resources/banners/banner-1280x640.jpg Binary files differ. diff --git a/lib/resources/banners/banner-FFFFFF.png b/lib/resources/banners/banner-FFFFFF.png Binary files differ. diff --git a/lib/resources/banner.png b/lib/resources/banners/banner.png Binary files differ. diff --git a/tsconfig.json b/tsconfig.json @@ -22,7 +22,7 @@ // "removeComments": true, /* Do not emit comments to output. */ // "noEmit": true, /* Do not emit outputs. */ "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ /* Strict Type-Checking Options */