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",
"webUrl": "http://localhost",
"webHost": "lolcathost",
"webPort": 80,
"servers": {
"freenode": {

View File

@ -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}));
}

View File

@ -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'));
}

4
run.js
View File

@ -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

View File

@ -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}"
}
}