From 78837f9da13884d0eee8197422d73edcf968d26f Mon Sep 17 00:00:00 2001 From: Sam Nicholls Date: Thu, 6 Dec 2012 19:33:25 +0000 Subject: [PATCH] Added url string --- config.json.sample | 2 +- modules/poll.js | 7 ++++--- modules/quotes.js | 4 +++- run.js | 4 ++-- strings.json | 14 ++++++++++---- 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/config.json.sample b/config.json.sample index b1454ce..d665e9c 100644 --- a/config.json.sample +++ b/config.json.sample @@ -1,6 +1,6 @@ { "name": "testressionbot", - "webUrl": "http://localhost", + "webHost": "lolcathost", "webPort": 80, "servers": { "freenode": { diff --git a/modules/poll.js b/modules/poll.js index 8016d01..2b82282 100644 --- a/modules/poll.js +++ b/modules/poll.js @@ -39,8 +39,8 @@ var poll = function(dbot) { } } - event.reply(dbot.t('poll_created', {'name': name, 'description': description}) + - ' - ' + dbot.webUrl + ':' + dbot.webPort + '/polls/' + name); + event.reply(dbot.t('poll_created', {'name': name, 'description': description, + 'url': dbot.t('url', {'host': dbot.webHost, 'port': dbot.webPort, 'path': 'polls/' + name})})); } } }, @@ -140,7 +140,8 @@ var poll = function(dbot) { '~pdesc': function(event) { var name = event.input[1]; if(polls.hasOwnProperty(name)) { - event.reply(name + ': ' + polls[name].description + ' - ' + dbot.webUrl + ':' + dbot.webPort + '/polls/' + name); + event.reply(dbot.t('poll_describe', {'name': name, 'description': polls[name].description, + 'url': dbot.t('url', {'host': dbot.webHost, 'port': dbot.webPort, 'path': 'polls/' + name})})); } else { event.reply(dbot.t('poll_unexistent', {'name': name})); } diff --git a/modules/quotes.js b/modules/quotes.js index abd2069..bb00730 100644 --- a/modules/quotes.js +++ b/modules/quotes.js @@ -186,7 +186,9 @@ var quotes = function(dbot) { '~link': function(event) { var key = event.params[1].trim().toLowerCase(); if(quotes.hasOwnProperty(key)) { - event.reply(dbot.t('quote_link', {'category': key}) + ' - ' + dbot.webUrl + ':' + dbot.webPort + '/quotes/' + key); + event.reply(dbot.t('quote_link', {'category': key, + 'url': dbot.t('url', {'host': dbot.webHost, + 'port': dbot.webPort, 'path': 'quotes/' + key})})); } else { event.reply(dbot.t('category_not_found')); } diff --git a/run.js b/run.js index 72858ad..0aa79b2 100644 --- a/run.js +++ b/run.js @@ -56,9 +56,9 @@ var DBot = function(timers) { // Populate bot properties with config data this.name = this.config.name || 'dbox'; this.admin = this.config.admin || [ 'reality' ]; - this.moduleNames = this.config.modules || [ 'ignore', 'admin', 'command', 'dice', 'js', 'kick', 'puns', 'quotes', 'spelling', 'youare' ]; + this.moduleNames = this.config.modules || [ 'ignore', 'admin', 'command', 'dice', 'js', 'kick', 'puns', 'quotes', 'spelling', 'youare', 'poll' ]; this.language = this.config.language || 'english'; - this.webUrl = this.config.webUrl || 'http://lolcathost'; + this.webHost = this.config.webHost || 'localhost'; this.webPort = this.config.webPort || 80; // It's the user's responsibility to fill this data structure up properly in diff --git a/strings.json b/strings.json index 329f7f0..803d38e 100644 --- a/strings.json +++ b/strings.json @@ -175,7 +175,7 @@ "na'vi": "{correcter} fpìl futa sweylu {candiate} pamrel sivi: {fix}" }, "quote_link": { - "english": "Link to {category}", + "english": "Link to {category} - {url}", "spanish": "Enlace a {category}", "na'vi": "Fya'o {category}ne" }, @@ -260,9 +260,12 @@ "na'vi": "sìpawm sna'o '{name}' fkeytok srekrr." }, "poll_created": { - "english": "Poll '{name}' created ({description}). Cast thy votations!", - "spanish" : "Votación '{name}' creado ({description}). ¡Emited sus votas!", - "na'vi": "sìpawm sna'o '{name}' ngìyop ({description}). Nga tìpe'unit Pe'eiun" + "english": "Poll '{name}' created ({description}). Cast thy votations! - {url}", + "spanish" : "Votación '{name}' creado ({description}). ¡Emited sus votas! - {url}", + "na'vi": "sìpawm sna'o '{name}' ngìyop ({description}). Nga tìpe'unit Pe'eiun - {url}" + }, + "poll_describe": { + "english": "{name}: {description} - {url}" }, "changed_vote": { "english": "{user} changed their vote in {poll} to '{vote}' ({count}).", @@ -317,5 +320,8 @@ "count": { "english": "The running-order of poll '{poll}' ({description}) is: {places}.", "na'vi": "Sute tsnì pole'un '{poll}'mì ({description}) lu: {places}." + }, + "url": { + "english": "http://{host}:{port}/{path}" } }