3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-02 17:09:29 +01:00

Adding config option to auto-add hashes to qdb

This should be useful for keeping track of certain massively duplicated
images.
This commit is contained in:
Douglas Gardner 2013-05-20 15:18:19 +00:00
parent fb24c4d8ee
commit be1ea0acde
2 changed files with 14 additions and 7 deletions

View File

@ -4,5 +4,9 @@
"imagelength": 5, "imagelength": 5,
"nsfwwarn": true, "nsfwwarn": true,
"apikey": "86fd3a8da348b65", "apikey": "86fd3a8da348b65",
"highscore": "ricount" "highscore": "ricount",
"autoadd": {
"e49e686582ce3f60cb51d00c10924861": "facebookman",
"b11b634c74562bcd4e5d17b0d90987be": "raffleguy"
}
} }

View File

@ -52,12 +52,15 @@ var imgur = function(dbot) {
if(!error && response.statusCode == 200 && body.length != 492) { if(!error && response.statusCode == 200 && body.length != 492) {
this.db.totalImages += 1; this.db.totalImages += 1;
var hash = crypto.createHash('md5').update(body).digest("hex"); var hash = crypto.createHash('md5').update(body).digest("hex");
if((hash == "e49e686582ce3f60cb51d00c10924861") && _.has(dbot.modules, 'quotes')){ if(_.has(dbot.modules, 'quotes')){
var qdb = dbot.db.quoteArrs["facebookman"]; // autoadd: {"abcdef": "facebookman"}
if (_.include(qdb, testUrl)){ if(_.has(dbot.config.imgur.autoadd,hash)){
// do something var category = dbot.config.imgur.autoadd[hash];
} else { if (_.contains(category, testUrl)){
qdb.push(testUrl); // there's probably less than 62^5 chance of this happening
} else {
dbot.db.quoteArrs[category].push(testUrl);
}
} }
} }
callback(testUrl, testSlug,hash); callback(testUrl, testSlug,hash);