mirror of
https://github.com/reality/dbot.git
synced 2024-11-24 04:49:25 +01:00
Moved admin strings to json
* Moved strings from hardcoded ``admin/commands.js`` to ``admin/strings.json`` to aid translation * Bump total string count to a rather large number * Tidy some JS I noticed whilst in the vicinity
This commit is contained in:
parent
0517ba687d
commit
b31ca20d92
@ -110,7 +110,7 @@ var commands = function(dbot) {
|
|||||||
event.reply(stdout);
|
event.reply(stdout);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
event.reply("No version information or queried module not loaded");
|
event.reply(dbot.t("no_version"));
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
},
|
},
|
||||||
@ -121,12 +121,12 @@ 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(moduleName + ' status: Shit looks good.');
|
event.reply(dbot.t("status_good",{"module":moduleName, "reason": status}));
|
||||||
} else {
|
} else {
|
||||||
event.reply(moduleName + ' status: Failed to load: ' + status);
|
event.reply(dbot.t("status_bad",{"module":moduleName, "reason": status}));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.reply('Either that module wasn\'t on the roster or shit is totally fucked.');
|
event.reply(dbot.t("status_unloaded"));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ var commands = function(dbot) {
|
|||||||
'say': function(event) {
|
'say': function(event) {
|
||||||
var channel = event.params[1];
|
var channel = event.params[1];
|
||||||
if(event.params[1] === "@") {
|
if(event.params[1] === "@") {
|
||||||
var channel = event.channel.name;
|
channel = event.channel.name;
|
||||||
}
|
}
|
||||||
var message = event.params.slice(2).join(' ');
|
var message = event.params.slice(2).join(' ');
|
||||||
dbot.say(event.server, channel, message);
|
dbot.say(event.server, channel, message);
|
||||||
@ -156,7 +156,7 @@ var commands = function(dbot) {
|
|||||||
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('Failed to load ' + moduleName + '. See \'status ' + moduleName + '\'.');
|
event.reply(dbot.t("load_failed",{"module": moduleName}));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(moduleName == 'web') {
|
if(moduleName == 'web') {
|
||||||
@ -197,7 +197,7 @@ var commands = function(dbot) {
|
|||||||
var configPath = getCurrentConfig(configPathString);
|
var configPath = getCurrentConfig(configPathString);
|
||||||
|
|
||||||
if(configPath == false || _.isUndefined(configPath.value)) {
|
if(configPath == false || _.isUndefined(configPath.value)) {
|
||||||
event.reply("Config key doesn't exist bro");
|
event.reply(dbot.t("no_config_key"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var currentOption = configPath.value;
|
var currentOption = configPath.value;
|
||||||
@ -208,14 +208,14 @@ var commands = function(dbot) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(_.isArray(currentOption)) {
|
if(_.isArray(currentOption)) {
|
||||||
event.reply("Config option is an array. Try 'pushconfig'.");
|
event.reply(dbot.t("config_array",{"alternate": "pushconfig"}));
|
||||||
}
|
}
|
||||||
|
|
||||||
event.reply(configPathString + ": " + currentOption + " -> " + newOption);
|
event.reply(configPathString + ": " + currentOption + " -> " + newOption);
|
||||||
configPath['user'][configKey] = newOption;
|
configPath['user'][configKey] = newOption;
|
||||||
dbot.reloadModules();
|
dbot.reloadModules();
|
||||||
} else {
|
} else {
|
||||||
event.reply("This config option cannot be altered while the bot is running.");
|
event.reply(dbot.t("config_lock"));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -227,14 +227,14 @@ var commands = function(dbot) {
|
|||||||
if(!_.include(noChangeConfig, configKey)) {
|
if(!_.include(noChangeConfig, configKey)) {
|
||||||
var configPath = getCurrentConfig(configPathString);
|
var configPath = getCurrentConfig(configPathString);
|
||||||
if(configPath == false || _.isUndefined(configPath.value)) {
|
if(configPath == false || _.isUndefined(configPath.value)) {
|
||||||
event.reply("Config key doesn't exist bro");
|
event.reply(dbot.t("no_config_key"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var currentArray = configPath.value;
|
var currentArray = configPath.value;
|
||||||
|
|
||||||
if(!_.isArray(currentArray)) {
|
if(!_.isArray(currentArray)) {
|
||||||
event.reply("Config option is not an array. Try 'setconfig'.");
|
event.reply(dbot.t("config_array",{"alternate": "setconfig"}));
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.reply(configPathString + ": " + currentArray + " << " + newOption);
|
event.reply(configPathString + ": " + currentArray + " << " + newOption);
|
||||||
@ -249,20 +249,20 @@ var commands = function(dbot) {
|
|||||||
|
|
||||||
if(configPathString) {
|
if(configPathString) {
|
||||||
var configKey = _.last(configPathString.split('.'));
|
var configKey = _.last(configPathString.split('.'));
|
||||||
if(configKey == false) {
|
if(configKey) {
|
||||||
event.reply("Config path doesn't exist");
|
event.reply(dbot.t("no_config_path"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_.isArray(configPath.value)) {
|
if(_.isArray(configPath.value)) {
|
||||||
event.reply(configKey + ': ' + configPath.value);
|
event.reply(configKey + ': ' + configPath.value);
|
||||||
} else if(_.isObject(configPath.value)) {
|
} else if(_.isObject(configPath.value)) {
|
||||||
event.reply('Config keys in ' + configPathString + ': ' + Object.keys(configPath.value));
|
event.reply(dbot.t("config_keys_location",{"path":configPathString,"value":Object.keys(configPath.value)}));
|
||||||
} else {
|
} else {
|
||||||
event.reply(configKey + ': ' + configPath.value);
|
event.reply(configKey + ': ' + configPath.value);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.reply('Config keys in root: ' + Object.keys(configPath['default']));
|
event.reply(dbot.t("config_keys_location",{"path":"root","value":Object.keys(configPath['default'])}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -95,5 +95,35 @@
|
|||||||
"en": "{moduleName} is already loaded.",
|
"en": "{moduleName} is already loaded.",
|
||||||
"na'vi": "Oel omum teri {moduleName}it li.",
|
"na'vi": "Oel omum teri {moduleName}it li.",
|
||||||
"nl": "{moduleName} is al geladen."
|
"nl": "{moduleName} is al geladen."
|
||||||
|
},
|
||||||
|
"no_version": {
|
||||||
|
"en": "No version information or queried module not loaded."
|
||||||
|
},
|
||||||
|
"status_good": {
|
||||||
|
"en": "{module} status: Shit looks good"
|
||||||
|
},
|
||||||
|
"status_bad": {
|
||||||
|
"en": "{module} status: Failed to load: {reason}"
|
||||||
|
},
|
||||||
|
"status_unloaded": {
|
||||||
|
"en": "Either thata module wasn't on the roster or shit is totally fucked."
|
||||||
|
},
|
||||||
|
"load_failed": {
|
||||||
|
"en": "Failed to load {module}. See 'status {module}'."
|
||||||
|
},
|
||||||
|
"no_config_key": {
|
||||||
|
"en": "Config key doesn't exist bro"
|
||||||
|
},
|
||||||
|
"config_array": {
|
||||||
|
"en": "Config option is an array. Try '{alternate}'."
|
||||||
|
},
|
||||||
|
"config_lock": {
|
||||||
|
"en": "This config option cannot be altered while the bot is running."
|
||||||
|
},
|
||||||
|
"no_config_path": {
|
||||||
|
"en": "Config path doesn't exist bro"
|
||||||
|
},
|
||||||
|
"config_keys_location": {
|
||||||
|
"en": "Config keys in {path}: {value}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user