diff --git a/modules/quotes/commands.js b/modules/quotes/commands.js index dbcbe73..34166aa 100644 --- a/modules/quotes/commands.js +++ b/modules/quotes/commands.js @@ -199,7 +199,7 @@ var commands = function(dbot) { 'url': dbot.t('url', { 'host': dbot.config.web.webHost, 'port': dbot.config.web.webPort, - 'path': 'quotes/' + key + 'path': 'quotes/' + encodeURIComponent(key) }) })); } else { diff --git a/run.js b/run.js index fadc12b..d6237fc 100644 --- a/run.js +++ b/run.js @@ -86,16 +86,17 @@ DBot.prototype.say = function(server, channel, message) { // Format given stored string in config language DBot.prototype.t = function(string, formatData) { - var formattedString; + var formattedString = 'String not found. Something has gone screwy. Maybe.'; + if(_.has(this.strings, string)) { var lang = this.config.language; if(!_.has(this.strings[string], lang)) { lang = "en"; } - formattedString = this.strings[string][lang].format(formatData); - } else { - formattedString = 'String not found. Something has gone screwy. Maybe.'; + if(_.has(this.strings[string], lang)) { + formattedString = this.strings[string][lang].format(formatData); + } } return formattedString;