Guest User

Untitled

a guest
Nov 4th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. async function updateAdded(followersToAdd, username = 'blower1223', db = amng){
  2. const lel = await db.find({collection:COLLECTION, where: {username: username}});
  3. const all = await lel[0].followersAdded + followersToAdd;
  4. await amng.update({
  5. collection: COLLECTION,
  6. where: { username: username },
  7. row: { followersAdded: all }
  8. })
  9. }
  10.  
  11. await amng.connect();
  12. const loginInfo = await amng.find({ collection: COLLECTION }, {});
  13. console.log(loginInfo);
  14. let temp = [];
  15. loginInfo.map((user) => {
  16. temp.push(new Instagram({ username: user.username, password: user.password }))
  17. });
  18. const users = temp;
  19. temp = [];
  20. let that = this;
  21.  
  22.  
  23. let timerId = setTimeout(async function approveSession() {
  24. for (let i = 0; i < users.length; i++) {
  25. const client = users[i];
  26. await client.login();
  27. const req = await client.getFollowRequests();
  28. console.log(req);
  29. await updateAdded(req.length);
  30. for (let i = 0; i < req.length; i++) {
  31. const elem = req[i];
  32. await client.approve({ userId: elem.node.id });
  33. }
  34. }
  35. timerId = setTimeout(approveSession, 3000);
  36. }, 3000);
Add Comment
Please, Sign In to add comment