-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathlibrary.js
57 lines (56 loc) · 1.92 KB
/
library.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
var steem = require('steem');
var config = require('./config');
steem.api.setOptions({ url: config.steem.url });
var followingArray = [];
var followersArray = [];
var mTimeout = 0;
module.exports = {
getFollowing: function(username=config.steem.username,start=config.steem.start,count=100,callback) {
steem.api.getFollowing(username, start, 'blog', 100, function(err, result){
//console.log( err, result );
start = '';
count = result.length;
for (let i = 1; i < count; i++) {
followingArray.push(result[i].following);
start = result[i].following;
}
if( count === 100 )
module.exports.getFollowing( username, start, count, callback );
else {
let nFollowingArray = followingArray.slice();
followingArray = [];
callback(nFollowingArray);
}
});
},
getFollowers: function(username=config.steem.username,start=config.steem.start,count=1000,callback) {
steem.api.getFollowers(username, start, 'blog', 100, function(err, result){
//console.log( err, result );
start = '';
count = result.length;
for (let i = 0; i < count-1; i) {
followersArray.push(result[++i].follower);
start = result[i].follower;
}
if( count === 100 )
module.exports.getFollowers( username, start, count, callback );
else {
let nFollowersArray = followersArray.slice();
followersArray = [];
callback(nFollowersArray);
}
});
},
getRebloggedBy: function(username=config.steem.username,contest_permlink=config.steem.contest_permlink,callback) {
steem.api.getRebloggedBy(username,contest_permlink, function(err, result) {
//console.log( err, result );
callback( result );
});
},
getAccounts: function(accounts=null,callback) {
steem.api.getAccounts(accounts, function(err, result){
//console.log( err, result );
callback( result );
});
}
};