diff options
| author | 8cy <[email protected]> | 2020-04-07 11:24:14 -0700 |
|---|---|---|
| committer | 8cy <[email protected]> | 2020-04-07 11:24:14 -0700 |
| commit | 54daed3d7760d4bf5f2b88d73b5ccb0c51ee4e25 (patch) | |
| tree | 2056fc150c0ece548e462a45cc97b7ff34815fc0 | |
| parent | add cmd aliases, v1.3.1 (diff) | |
| download | s5nical-54daed3d7760d4bf5f2b88d73b5ccb0c51ee4e25.tar.xz s5nical-54daed3d7760d4bf5f2b88d73b5ccb0c51ee4e25.zip | |
add uptime command, v1.3.2
| -rw-r--r-- | app.js | 9 | ||||
| -rw-r--r-- | package.json | 2 |
2 files changed, 11 insertions, 0 deletions
@@ -23,6 +23,10 @@ bot.on('error', console.error); bot.on('message', async msg => {
//if (msg.channel.name === 'bots' || msg.channel.name === 'bot-commands' || msg.member.hasPermission('KICK_MEMBERS')) {
+ const upTime = require('moment');
+ require('moment-duration-format');
+ const duration = upTime.duration(bot.uptime).format(" D [days], H [hrs], m [mins], s [secs]");
+
var msgContent = msg.content.toLowerCase();
if (prefixCheck()) {
console.log(msg.member.user.tag, 'says', msgContent, 'in #' + msg.channel.name);
@@ -114,6 +118,11 @@ bot.on('message', async msg => { //return;
}
+ // Small command which need variables
+ if (command == 'uptime') {
+ msg.reply(duration);
+ }
+
// Reacts with ping emoji when @everyone
if (msg.mentions.everyone) {
msg.react(':ArisaPing:695887537390223402');
diff --git a/package.json b/package.json index 9e0f1e4..4910456 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,8 @@ "emoji-random": "^0.1.2", "ffmpeg-static": "^4.0.1", "is-image-url": "^1.1.8", + "moment": "^2.24.0", + "moment-duration-format": "^2.3.2", "ytdl-core": "^2.0.1" } } |