Merge github.com:reality/depressionbot into database

This commit is contained in:
reality 2013-05-20 15:27:22 +00:00
commit b3d2b89734
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

@ -51,6 +51,17 @@ var imgur = function(dbot) {
if(!error && response.statusCode == 200 && body.length != 492) {
dbot.db.imgur.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;
}
};
});