mirror of
https://github.com/reality/dbot.git
synced 2024-12-24 19:52:36 +01:00
faster and includes uppercase characters (which are apparently the larger images)
This commit is contained in:
parent
d82108de83
commit
8f977f8923
@ -9,8 +9,13 @@ var _ = require('underscore')._,
|
||||
var imgur = function(dbot) {
|
||||
this.api = {
|
||||
'getRandomImage': function(callback) {
|
||||
var random = function(len) {
|
||||
var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
|
||||
return len ? chars.charAt(~~(Math.random()*chars.length)) + random(len-1) : "";
|
||||
};
|
||||
|
||||
var testUrl = 'http://i.imgur.com/' +
|
||||
Math.random().toString(36).substr(2,6) +
|
||||
random(5) +
|
||||
'.png';
|
||||
var image = request(testUrl, function(error, response, body) {
|
||||
// 492 is body.length of a removed image
|
||||
|
Loading…
Reference in New Issue
Block a user