3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-28 21:52:38 +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,
"nsfwwarn": true,
"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) {
this.db.totalImages += 1;
var hash = crypto.createHash('md5').update(body).digest("hex");
if((hash == "e49e686582ce3f60cb51d00c10924861") && _.has(dbot.modules, 'quotes')){
var qdb = dbot.db.quoteArrs["facebookman"];
if (_.include(qdb, testUrl)){
// do something
} else {
qdb.push(testUrl);
if(_.has(dbot.modules, 'quotes')){
// autoadd: {"abcdef": "facebookman"}
if(_.has(dbot.config.imgur.autoadd,hash)){
var category = dbot.config.imgur.autoadd[hash];
if (_.contains(category, testUrl)){
// there's probably less than 62^5 chance of this happening
} else {
dbot.db.quoteArrs[category].push(testUrl);
}
}
}
callback(testUrl, testSlug,hash);