diff --git a/modules/admin/commands.js b/modules/admin/commands.js index e7172ba..583b09e 100644 --- a/modules/admin/commands.js +++ b/modules/admin/commands.js @@ -72,7 +72,7 @@ var commands = function(dbot) { event.reply(stdout); } else{ - event.reply("No version information or queried module not loaded"); + event.reply(dbot.t("no_version")); } }.bind(this)); }, @@ -83,12 +83,12 @@ var commands = function(dbot) { if(_.has(dbot.status, moduleName)) { var status = dbot.status[moduleName]; if(status === true) { - event.reply(moduleName + ' status: Shit looks good.'); + event.reply(dbot.t("status_good",{"module":moduleName, "reason": status})); } else { - event.reply(moduleName + ' status: Failed to load: ' + status); + event.reply(dbot.t("status_bad",{"module":moduleName, "reason": status})); } } else { - event.reply('Either that module wasn\'t on the roster or shit is totally fucked.'); + event.reply(dbot.t("status_unloaded")); } }, @@ -103,7 +103,7 @@ var commands = function(dbot) { 'say': function(event) { var channel = event.params[1]; if(event.params[1] === "@") { - var channel = event.channel.name; + channel = event.channel.name; } var message = event.params.slice(2).join(' '); dbot.say(event.server, channel, message); @@ -118,7 +118,7 @@ var commands = function(dbot) { if(dbot.status[moduleName] === true) { event.reply(dbot.t('load_module', {'moduleName': moduleName})); } else { - event.reply('Failed to load ' + moduleName + '. See \'status ' + moduleName + '\'.'); + event.reply(dbot.t("load_failed",{"module": moduleName})); } } else { if(moduleName == 'web') { @@ -162,6 +162,10 @@ var commands = function(dbot) { newOption = (newOption == "true"); } + if(_.isArray(currentOption)) { + event.reply(dbot.t("config_array",{"alternate": "pushconfig"})); + } + event.reply(configPath + ": " + config + " -> " + newOption); config = newOption; this.db.save('config', configPath, { @@ -171,11 +175,11 @@ var commands = function(dbot) { dbot.reloadModules(); }); } else { - event.reply('Config path doesn\'t exist, bro.'); + event.reply(dbot.t("no_config_key")); } }.bind(this)); } else { - event.reply("This config option cannot be altered while the bot is running."); + event.reply(dbot.t("config_lock")); } }, @@ -196,14 +200,14 @@ var commands = function(dbot) { dbot.reloadModules(); }); } else { - event.reply("Config option is not an array. Try 'setconfig'."); + event.reply(dbot.t("config_array", { "alternate": "setconfig" })); } } else { - event.reply('Config path doesn\'t exist, bro.'); + event.reply(dbot.t("no_config_key")); } }.bind(this)); } else { - event.reply("This config option cannot be altered while the bot is running."); + event.reply(dbot.t("config_lock")); } }, @@ -213,18 +217,30 @@ var commands = function(dbot) { this.internalAPI.getCurrentConfig(configPath, function(config) { if(config !== null) { if(_.isArray(config)) { - event.reply('Config keys in ' + configPath + ': ' + config); + event.reply(dbot.t("config_keys_location", { + "path": configPath, + "value": config + })); } else if(_.isObject(config)) { - event.reply('Config keys in ' + configPath + ': ' + _.keys(config)); + event.reply(dbot.t("config_keys_location", { + "path": configPath, + "value": _.keys(config) + })); } else { - event.reply(configPath + ': ' + config); + event.reply(dbot.t("config_keys_location", { + "path": configPath, + "value": config + })); } } else { - event.reply('Config path doesn\'t exist, bro.'); + event.reply(dbot.t("no_config_key")); } }); } else { - event.reply('Config keys in root: ' + _.keys(dbot.config)); + event.reply(dbot.t("config_keys_location", { + "path": "root", + "value": _.keys(dbot.config) + })); } } }; diff --git a/modules/admin/strings.json b/modules/admin/strings.json index 44bc5e6..0f3e5a0 100644 --- a/modules/admin/strings.json +++ b/modules/admin/strings.json @@ -95,5 +95,35 @@ "en": "{moduleName} is already loaded.", "na'vi": "Oel omum teri {moduleName}it li.", "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}" } } diff --git a/modules/project/pages.js b/modules/project/pages.js index 5578d68..929d7a8 100644 --- a/modules/project/pages.js +++ b/modules/project/pages.js @@ -30,7 +30,7 @@ var pages = function(dbot) { /* TODO: merge back into github module */ var milestones; - request("https://api.github.com/repos/" + dbot.config.github.defaultrepo + "/milestones?state=open", function(error, response, body){ + request({"url":"https://api.github.com/repos/" + dbot.config.github.defaultrepo + "/milestones?state=open","headers":{"User-Agent":"reality/depressionbot (project module)"}}, function(error, response, body){ milestones = JSON.parse(body); }); diff --git a/modules/users/README.md b/modules/users/README.md index 0a11e5b..ee157de 100644 --- a/modules/users/README.md +++ b/modules/users/README.md @@ -5,8 +5,7 @@ Track users. ### Description This module tracks users and their aliases through nick changes and all that -kind of thing. It's mainly a utility module for other modules to use. It's -also totally !insaned. +kind of thing. It's mainly a utility module for other modules to use. ### Commands @@ -27,25 +26,51 @@ Requires moderator level access by default. ### API -#### resolveUser(server, nick, [useLowerCase]) -This resolves a given nick to its primary user and returns it. +#### resolveUser(server, nick, callback) +This resolves a given nick to its primary user, returning false if no user +record is found in the store associated with the given nickname (either as a +primary nick or an alias). The callback is called with one argument, a _user_ +object or false if no user was found. -Note that if the useLowerCase argument is set to true, it will do a lower-case -search, however it will return the username in its properly capitalised form, so -remember to lower case the return value if you are using lower case values as -keys. +#### getUser(uuid, callback) +Get a user by its uuid. Callback is called with one argument, a _user_ object or +false if no user was found by that uuid. -#### resolveUser(server, user) -Return whether a user is known either as an alias or a primary user. +#### getChannel(server, channelName, callback) +This resolves a given server and channel name to a particular channel. The +callback is called with one argument, a _channel_ object or false if no channel +was found with the given name on the given server. -#### isPrimaryUser(server, nick) -Return whether a nick is known as a primary user. +#### getRandomChannelUser(server, channel, callback) +Given a server name and a channel name, this gets a random user from that +channel. Callback is called with one argument, a _user_ object or false if no +channel was found from the given parameters. -#### getAliases(server, user) -Return a list of aliases for a given primary user. +#### getAllusers(callback) +Get a list of all users the bot currently knows about. Callback is called with +one argument, a list of user records. -#### isOnline(server, user, channel, useLowerCase) -Return whether a user is online in a given channel on the given server. +### Data + +#### User Object + + { + id: user uuid, + primaryNick, + currentNick: Current or last used nickname, + server, + channels: A list of names for channels this user has been in, + aliases: A list of known aliases for this user + } + +#### Channel Object + + { + id: channel uuid, + server, + name, + users: A list of the uuids of users who are in this channel + } ### Events diff --git a/public/project.js b/public/project.js index 697c5f6..0dda7b5 100644 --- a/public/project.js +++ b/public/project.js @@ -1,15 +1,17 @@ +WebFontConfig={google:{families:["Ubuntu+Mono::latin","Ubuntu::latin"]}};(function(){var e=document.createElement("script");e.src=("https:"==document.location.protocol?"https":"http")+"://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js";e.type="text/javascript";e.async="true";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)})() $(document).ready(function() { $.get("https://api.github.com/repos/#{repo}/pulls", function(data) { if ($.parseJSON(data).length) { $("#pullreq").show();} }); }); $(document).keypress(function(e) { -WebFontConfig={google:{families:["Ubuntu::latin"]}};(function(){var e=document.createElement("script");e.src=("https:"==document.location.protocol?"https":"http")+"://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js";e.type="text/javascript";e.async="true";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)})() $('body').css({ "background-image":"url('http://i.imgur.com/Yh8V2Oa.jpg')", "font-family": "Ubuntu, \"Source Sans Pro\",sans-serif" }); + $('pre').css("font-family","Ubuntu Mono"); $('a').css("color","#DD4814"); $('#title').css("color","white"); - $('#main').css("border-color","#420432"); + $('.progress-inner').css("background-image","linear-gradient(to top, rgb(211, 72, 20), rgb(255, 180, 127))"); +// $('#main').css("color","#420432"); });