mirror of
https://github.com/reality/dbot.git
synced 2024-11-24 04:49:25 +01:00
commit
2683ce268c
@ -21,3 +21,5 @@ page. If called without a link, the bot will attempt the same on the last link
|
|||||||
which was posted in the current channel.
|
which was posted in the current channel.
|
||||||
#### ~ud [headword]
|
#### ~ud [headword]
|
||||||
Returns the first [Urban Dictionary](http://www.urbandictionary.com) definition for the headword provided.
|
Returns the first [Urban Dictionary](http://www.urbandictionary.com) definition for the headword provided.
|
||||||
|
#### ~xkcd <comic ID>
|
||||||
|
Returns a link to the [xkcd](http://xkcd.com) comic specified, or the latest one if a comic is not given.
|
||||||
|
@ -32,6 +32,24 @@ var link = function(dbot) {
|
|||||||
}
|
}
|
||||||
this.fetchTitle(event, link);
|
this.fetchTitle(event, link);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'~xkcd': function(event) {
|
||||||
|
var comicId = event.params[1];
|
||||||
|
if(comicId){
|
||||||
|
comicId = comicId + "/";
|
||||||
|
} else {
|
||||||
|
comicId = "";
|
||||||
|
}
|
||||||
|
var link = "http://xkcd.com/"+comicId+"info.0.json";
|
||||||
|
request(link, function(error, response, body) {
|
||||||
|
if (response.statusCode == "200") {
|
||||||
|
data = JSON.parse(body);
|
||||||
|
event.reply(dbot.t("xkcd",data));
|
||||||
|
} else {
|
||||||
|
event.reply(dbot.t("no-hits"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
'~ud': function(event) {
|
'~ud': function(event) {
|
||||||
var query = event.input[1];
|
var query = event.input[1];
|
||||||
|
@ -2,5 +2,11 @@
|
|||||||
"title_not_found": {
|
"title_not_found": {
|
||||||
"english": "No page title found.",
|
"english": "No page title found.",
|
||||||
"na'vi": "Oel ke tsun run 'upxare atxin."
|
"na'vi": "Oel ke tsun run 'upxare atxin."
|
||||||
|
},
|
||||||
|
"xkcd": {
|
||||||
|
"english": "xkcd {num}: {title} https://xkcd.com/{num}"
|
||||||
|
},
|
||||||
|
"no-hits": {
|
||||||
|
"english": "No hits."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user