3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-30 16:09:27 +01:00

Merge git://github.com/reality/depressionbot into database

This commit is contained in:
reality 2013-03-28 22:12:43 +00:00
commit c1224a8f2c
4 changed files with 17 additions and 6 deletions

View File

@ -11,7 +11,9 @@ var link = function(dbot) {
this.urlRegex = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
this.links = {};
this.fetchTitle = function(event, link) {
request(link, function(error, response, body) {
var limit = 250 * 1000,
size = 0,
page = request(link, function(error, response, body) {
if(!error && response.statusCode == 200) {
body = body.replace(/(\r\n|\n\r|\n)/gm, " ");
var title = body.valMatch(/<title>(.*)<\/title>/, 2);
@ -20,6 +22,13 @@ var link = function(dbot) {
}
}
});
page.on('data', function(chunk) {
size += chunk.length;
if(size > limit) {
page.abort();
}
});
};
var commands = {

View File

@ -99,6 +99,7 @@ var spelling = function(dbot) {
var fix = this.last[event.channel.name][candidate].replace(winner, correction);
if (/^.ACTION/.test(fix)) {
fix = fix.replace(/^.ACTION/, '/me');
fix = fix.replace("\x01", '');
}
this.last[event.channel.name][candidate] = fix;
var output = {

View File

@ -1,18 +1,18 @@
{
"artist": {
"english": "{s} [artist] {artist}"
"en": "{s} [artist] {artist}"
},
"album": {
"english": "{s} [album] {artist} {album}"
"en": "{s} [album] {artist} {album}"
},
"track": {
"english": "{s} [track] {artist} {track} (from {album})"
"en": "{s} [track] {artist} {track} (from {album})"
},
"found": {
"english": "{s} [{url}] {artist} {track} (from {album})"
"en": "{s} [{url}] {artist} {track} (from {album})"
},
"not-found": {
"english": "{s} No results.",
"en": "{s} No results.",
"na'vi": "{s}, Oel ke tsun rivum ayuoti."
}
}

1
views/quotes/error.jade Normal file
View File

@ -0,0 +1 @@
p #{message}