Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shutdown CMD Added #20

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions bot/modules/bot-shutdown.js
Original file line number Diff line number Diff line change
@@ -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: '<pm2-name>',
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);
}
}
}
};
*/
39 changes: 39 additions & 0 deletions bot/modules/bot-shutdown.js.example
Original file line number Diff line number Diff line change
@@ -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: '<pm2-name>',
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);
}
}
}
};
*/