3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-24 03:33:07 +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}"
},
"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": {
"en": "Failed to load {module}. See 'status {module}'."

View File

@ -4,5 +4,9 @@
"imagelength": 5,
"nsfwwarn": true,
"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) {
this.db.totalImages += 1;
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);
} else {
this.api.getRandomImage(callback);

View File

@ -49,6 +49,7 @@ function getNewImage() {
$(getNewImage());
var t;
$(document).on('keydown', function(e){
switch(e.which){
case 82: // r
@ -72,5 +73,21 @@ $(document).on('keydown', function(e){
case 83: // s
$('body').toggleClass('crop');
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;
}
};
});