This commit is contained in:
reality 2013-05-06 15:53:42 +00:00
parent 090f15e738
commit 9db515d44a

View File

@ -82,9 +82,15 @@ var commands = function(dbot) {
if(_.has(dbot.status, moduleName)) { if(_.has(dbot.status, moduleName)) {
var status = dbot.status[moduleName]; var status = dbot.status[moduleName];
if(status === true) { if(status === true) {
event.reply(dbot.t("status_good",{"module":moduleName, "reason": status})); event.reply(dbot.t('status_good', {
'module': moduleName,
'reason': status
}));
} else { } else {
event.reply(dbot.t("status_bad",{"module":moduleName, "reason": status})); event.reply(dbot.t('status_bad', {
'module': moduleName,
'reason': status
}));
} }
} else { } else {
event.reply(dbot.t("status_unloaded")); event.reply(dbot.t("status_unloaded"));
@ -93,9 +99,11 @@ var commands = function(dbot) {
// Reload DB, translations and modules. // Reload DB, translations and modules.
'reload': function(event) { 'reload': function(event) {
event.reply(dbot.t('reload'));
dbot.db = JSON.parse(fs.readFileSync('db.json', 'utf-8')); dbot.db = JSON.parse(fs.readFileSync('db.json', 'utf-8'));
dbot.reloadModules(); dbot.reloadModules();
process.nextTick(function() {
event.reply(dbot.t('reload'));
});
}, },
// Say something in a channel // Say something in a channel
@ -114,11 +122,13 @@ var commands = function(dbot) {
if(!_.include(dbot.config.moduleNames, moduleName)) { if(!_.include(dbot.config.moduleNames, moduleName)) {
dbot.config.moduleNames.push(moduleName); dbot.config.moduleNames.push(moduleName);
dbot.reloadModules(); dbot.reloadModules();
process.nextTick(function() {
if(dbot.status[moduleName] === true) { if(dbot.status[moduleName] === true) {
event.reply(dbot.t('load_module', { 'moduleName': moduleName })); event.reply(dbot.t('load_module', { 'moduleName': moduleName }));
} else { } else {
event.reply(dbot.t("load_failed",{"module": moduleName})); event.reply(dbot.t('load_failed', { 'module': moduleName }));
} }
});
} else { } else {
if(moduleName == 'web') { if(moduleName == 'web') {
event.reply(dbot.t('already_loaded_web')); event.reply(dbot.t('already_loaded_web'));
@ -141,7 +151,9 @@ var commands = function(dbot) {
dbot.config.moduleNames = _.without(dbot.config.moduleNames, moduleName); dbot.config.moduleNames = _.without(dbot.config.moduleNames, moduleName);
dbot.reloadModules(); dbot.reloadModules();
process.nextTick(function() {
event.reply(dbot.t('unload_module', { 'moduleName': moduleName })); event.reply(dbot.t('unload_module', { 'moduleName': moduleName }));
});
} else { } else {
event.reply(dbot.t('unload_error', { 'moduleName': moduleName })); event.reply(dbot.t('unload_error', { 'moduleName': moduleName }));
} }