From afff24ea5d0ee6a182d154640452fdfb42dff782 Mon Sep 17 00:00:00 2001 From: Flummi Date: Fri, 5 May 2017 07:54:37 +0200 Subject: [PATCH] uptime --- src/trigger/uptime.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/trigger/uptime.js diff --git a/src/trigger/uptime.js b/src/trigger/uptime.js new file mode 100644 index 0000000..5fd3211 --- /dev/null +++ b/src/trigger/uptime.js @@ -0,0 +1,19 @@ +var exec = require('child_process').exec; + +module.exports = (lib) => { + lib.trigger.add({ + name: 'uptime', + call: /^!uptime/i, + level: 0, + active: 1, + func: (e) => { + exec('sudo systemctl status f0ck', (error, stdout) => { + if(error === null) { + let uptime = stdout.split('\n')[2].trim().replace("Active: active (running)", "i'm active"); + e.reply(uptime); + } + }); + }, + desc: 'Uptime' + }); +};