diff --git a/bot/modules/bot-shutdown.js b/bot/modules/bot-shutdown.js new file mode 100644 index 0000000..e9852d0 --- /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); + } + } + } +}; +*/ 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); + } + } + } +}; +*/