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:
commit
c1224a8f2c
@ -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 = {
|
||||
|
@ -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 = {
|
||||
|
@ -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
1
views/quotes/error.jade
Normal file
@ -0,0 +1 @@
|
||||
p #{message}
|
Loading…
Reference in New Issue
Block a user