3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-24 04:49:25 +01:00

greload command to git pull then reload

This commit is contained in:
Luke Slater 2012-03-10 17:56:38 +00:00
parent c7fcb9fe18
commit d4320bbde7

View File

@ -1,4 +1,6 @@
var fs = require('fs');
var sys = require('sys')
var exec = require('child_process').exec;
var adminCommands = function(dbot) {
var dbot = dbot;
@ -17,6 +19,15 @@ var adminCommands = function(dbot) {
dbot.instance.part(params[1]);
},
// Do a git pull and reload
'greload': function(data, params) {
var child;
child = exec("cd ../ && git pull", function (error, stdout, stderr) {
commands.reload(data, params);
}.bind(this));
},
'reload': function(data, params) {
dbot.db = JSON.parse(fs.readFileSync('db.json', 'utf-8'));
dbot.reloadModules();