forked from GitHub/dbot
Add tracking for a certain hash
This is a fairly simple hack to record any imgur URLs discovered via the random image facility that match a certain MD5 hash. A known bug with this commit is that it may crash the bot the first time the bot tries to add to the database, as the category is undefined. This can be easily worked around by ensuring that the category is prepopulated with at least one image before letting the bot add automatically. An issue should probably be opened to merge this code into something reading hashes from a configuration file: it's pretty hardcoded at the moment.
This commit is contained in:
parent
7578382bee
commit
5fd2a3923f
@ -52,6 +52,14 @@ 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);
|
||||
}
|
||||
}
|
||||
callback(testUrl, testSlug,hash);
|
||||
} else {
|
||||
this.api.getRandomImage(callback);
|
||||
|
Loading…
Reference in New Issue
Block a user