From ead133188af73ecfc556d3f1844416c1871fae67 Mon Sep 17 00:00:00 2001 From: God-Father <33990385+johnlito123@users.noreply.github.com> Date: Wed, 16 Jan 2019 19:30:31 +0000 Subject: [PATCH 1/3] Create bot-shutdown.js --- bot/modules/bot-shutdown.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 bot/modules/bot-shutdown.js diff --git a/bot/modules/bot-shutdown.js b/bot/modules/bot-shutdown.js new file mode 100644 index 0000000..2826fb3 --- /dev/null +++ b/bot/modules/bot-shutdown.js @@ -0,0 +1,36 @@ +/*let cmd = require('node-cmd'); +let shell = require('shelljs'); +let moment = require('moment-timezone'); +let isWindows = require('check-if-windows'); +let bot.msg.[userID] = require('../helpers.js').bot.msg.[userID]; +let config = require('config'); +let logChannel = config.get('moderation').logchannel; +let pm2Name = config.get('General').pm2Name; +exports.commands = ['shutdown']; +exports.shutdown = { + usage: '', + description: + ':desktop: :construction_worker: shuts down bot via pm2 :construction_worker: :desktop:', + process: function(bot, msg, suffix) { + if (bot.msg.[userID](msg)) { + if (suffix != pm2Name) { + return; + } + var time = moment() + .tz('America/Los_Angeles') + .format('MM-DD-YYYY hh:mm a'); + msg.channel.send('Shutting Down pm2 app (' + pm2Name + ')'); + bot.channels + .get(logChannel) + .send( + '[' + time + ' PST][' + pm2Name + '] Shutting Down pm2 app (veronica)' + ); + if (isWindows) { + cmd.run('pm2 stop ' + pm2Name); + } else { + shell.exec('pm2 stop ' + pm2Name); + } + } + } +}; +*/bot-shutdown.js From 49509b32c67bb28804fdf9a6344fb210e34e35f3 Mon Sep 17 00:00:00 2001 From: God-Father <33990385+johnlito123@users.noreply.github.com> Date: Wed, 16 Jan 2019 19:34:41 +0000 Subject: [PATCH 2/3] Create bot-shutdown.js.example --- bot/modules/bot-shutdown.js.example | 39 +++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 bot/modules/bot-shutdown.js.example diff --git a/bot/modules/bot-shutdown.js.example b/bot/modules/bot-shutdown.js.example new file mode 100644 index 0000000..b7ae88b --- /dev/null +++ b/bot/modules/bot-shutdown.js.example @@ -0,0 +1,39 @@ +// Simply add your Discord perosnal UserID under `bot.msg.[userID]` and remove breakets +//Please Note - User ID is not your username + +/*let cmd = require('node-cmd'); +let shell = require('shelljs'); +let moment = require('moment-timezone'); +let isWindows = require('check-if-windows'); +let bot.msg.23585678352345 = require('../helpers.js').bot.msg.23585678352345; +let config = require('config'); +let logChannel = config.get('moderation').logchannel; +let pm2Name = config.get('General').pm2Name; +exports.commands = ['shutdown']; +exports.shutdown = { + usage: '', + description: + ':desktop: :construction_worker: shuts down bot via pm2 :construction_worker: :desktop:', + process: function(bot, msg, suffix) { + if (bot.msg.23585678352345(msg)) { + if (suffix != pm2Name) { + return; + } + var time = moment() + .tz('America/Los_Angeles') + .format('MM-DD-YYYY hh:mm a'); + msg.channel.send('Shutting Down pm2 app (' + pm2Name + ')'); + bot.channels + .get(logChannel) + .send( + '[' + time + ' PST][' + pm2Name + '] Shutting Down pm2 app (veronica)' + ); + if (isWindows) { + cmd.run('pm2 stop ' + pm2Name); + } else { + shell.exec('pm2 stop ' + pm2Name); + } + } + } +}; +*/ From ff8b07f515e125442504f8f65d0d62bd08c5bc9d Mon Sep 17 00:00:00 2001 From: God-Father <33990385+johnlito123@users.noreply.github.com> Date: Wed, 16 Jan 2019 19:35:06 +0000 Subject: [PATCH 3/3] Update bot-shutdown.js --- bot/modules/bot-shutdown.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/modules/bot-shutdown.js b/bot/modules/bot-shutdown.js index 2826fb3..e9852d0 100644 --- a/bot/modules/bot-shutdown.js +++ b/bot/modules/bot-shutdown.js @@ -33,4 +33,4 @@ exports.shutdown = { } } }; -*/bot-shutdown.js +*/