summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author8cy <[email protected]>2020-04-07 11:24:14 -0700
committer8cy <[email protected]>2020-04-07 11:24:14 -0700
commit54daed3d7760d4bf5f2b88d73b5ccb0c51ee4e25 (patch)
tree2056fc150c0ece548e462a45cc97b7ff34815fc0
parentadd cmd aliases, v1.3.1 (diff)
downloads5nical-54daed3d7760d4bf5f2b88d73b5ccb0c51ee4e25.tar.xz
s5nical-54daed3d7760d4bf5f2b88d73b5ccb0c51ee4e25.zip
add uptime command, v1.3.2
-rw-r--r--app.js9
-rw-r--r--package.json2
2 files changed, 11 insertions, 0 deletions
diff --git a/app.js b/app.js
index 76176dd..d1903a3 100644
--- a/app.js
+++ b/app.js
@@ -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"
}
}