Added url string

This commit is contained in:
Sam Nicholls 2012-12-06 19:33:25 +00:00
parent 96225c59ec
commit 78837f9da1
5 changed files with 20 additions and 11 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "testressionbot", "name": "testressionbot",
"webUrl": "http://localhost", "webHost": "lolcathost",
"webPort": 80, "webPort": 80,
"servers": { "servers": {
"freenode": { "freenode": {

View File

@ -39,8 +39,8 @@ var poll = function(dbot) {
} }
} }
event.reply(dbot.t('poll_created', {'name': name, 'description': description}) + event.reply(dbot.t('poll_created', {'name': name, 'description': description,
' - ' + dbot.webUrl + ':' + dbot.webPort + '/polls/' + name); 'url': dbot.t('url', {'host': dbot.webHost, 'port': dbot.webPort, 'path': 'polls/' + name})}));
} }
} }
}, },
@ -140,7 +140,8 @@ var poll = function(dbot) {
'~pdesc': function(event) { '~pdesc': function(event) {
var name = event.input[1]; var name = event.input[1];
if(polls.hasOwnProperty(name)) { 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 { } else {
event.reply(dbot.t('poll_unexistent', {'name': name})); event.reply(dbot.t('poll_unexistent', {'name': name}));
} }

View File

@ -186,7 +186,9 @@ var quotes = function(dbot) {
'~link': function(event) { '~link': function(event) {
var key = event.params[1].trim().toLowerCase(); var key = event.params[1].trim().toLowerCase();
if(quotes.hasOwnProperty(key)) { 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 { } else {
event.reply(dbot.t('category_not_found')); event.reply(dbot.t('category_not_found'));
} }

4
run.js
View File

@ -56,9 +56,9 @@ var DBot = function(timers) {
// Populate bot properties with config data // Populate bot properties with config data
this.name = this.config.name || 'dbox'; this.name = this.config.name || 'dbox';
this.admin = this.config.admin || [ 'reality' ]; 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.language = this.config.language || 'english';
this.webUrl = this.config.webUrl || 'http://lolcathost'; this.webHost = this.config.webHost || 'localhost';
this.webPort = this.config.webPort || 80; this.webPort = this.config.webPort || 80;
// It's the user's responsibility to fill this data structure up properly in // It's the user's responsibility to fill this data structure up properly in

View File

@ -175,7 +175,7 @@
"na'vi": "{correcter} fpìl futa sweylu {candiate} pamrel sivi: {fix}" "na'vi": "{correcter} fpìl futa sweylu {candiate} pamrel sivi: {fix}"
}, },
"quote_link": { "quote_link": {
"english": "Link to {category}", "english": "Link to {category} - {url}",
"spanish": "Enlace a {category}", "spanish": "Enlace a {category}",
"na'vi": "Fya'o {category}ne" "na'vi": "Fya'o {category}ne"
}, },
@ -260,9 +260,12 @@
"na'vi": "sìpawm sna'o '{name}' fkeytok srekrr." "na'vi": "sìpawm sna'o '{name}' fkeytok srekrr."
}, },
"poll_created": { "poll_created": {
"english": "Poll '{name}' created ({description}). Cast thy votations!", "english": "Poll '{name}' created ({description}). Cast thy votations! - {url}",
"spanish" : "Votación '{name}' creado ({description}). ¡Emited sus votas!", "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" "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": { "changed_vote": {
"english": "{user} changed their vote in {poll} to '{vote}' ({count}).", "english": "{user} changed their vote in {poll} to '{vote}' ({count}).",
@ -317,5 +320,8 @@
"count": { "count": {
"english": "The running-order of poll '{poll}' ({description}) is: {places}.", "english": "The running-order of poll '{poll}' ({description}) is: {places}.",
"na'vi": "Sute tsnì pole'un '{poll}'mì ({description}) lu: {places}." "na'vi": "Sute tsnì pole'un '{poll}'mì ({description}) lu: {places}."
},
"url": {
"english": "http://{host}:{port}/{path}"
} }
} }