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

Merge pull request #451 from zuzak/borkborkbork

Add tracking for a certain hash
This commit is contained in:
Luke Slater 2013-05-20 08:27:10 -07:00
commit 5fd7e2ca50
4 changed files with 34 additions and 2 deletions

View File

@ -106,7 +106,7 @@
"en": "{module} status: Failed to load: {reason}" "en": "{module} status: Failed to load: {reason}"
}, },
"status_unloaded": { "status_unloaded": {
"en": "Either thata module wasn't on the roster or shit is totally fucked." "en": "Either that module wasn't on the roster or shit is totally fucked."
}, },
"load_failed": { "load_failed": {
"en": "Failed to load {module}. See 'status {module}'." "en": "Failed to load {module}. See 'status {module}'."

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,6 +52,17 @@ 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(_.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); callback(testUrl, testSlug,hash);
} else { } else {
this.api.getRandomImage(callback); this.api.getRandomImage(callback);

View File

@ -49,6 +49,7 @@ function getNewImage() {
$(getNewImage()); $(getNewImage());
var t;
$(document).on('keydown', function(e){ $(document).on('keydown', function(e){
switch(e.which){ switch(e.which){
case 82: // r case 82: // r
@ -72,5 +73,21 @@ $(document).on('keydown', function(e){
case 83: // s case 83: // s
$('body').toggleClass('crop'); $('body').toggleClass('crop');
giveMessage("Toggled scrollbars.") giveMessage("Toggled scrollbars.")
break;
case 190: // .
if(!t){
giveMessage("Automation on.");
$('#loading').css("font-style", "italic");
$('#loading').css("color","#BF2527");
t = setInterval(function(){
getNewImage();
},5000);
} else {
giveMessage("Automation off.");
$('#loading').css("font-style","normal");
$('#loading').css("color","#85BF25");
clearTimeout(t);
t = undefined;
}
}; };
}); });