Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. function sleep(ms) {
  2. return new Promise(resolve => {
  3. setTimeout(resolve, ms);
  4. });
  5. }
  6.  
  7. async function asyncForEach(array, client, callback) {
  8. for (let index = 0; index < array.length; index++) {
  9. await callback(array[index], client, index, array);
  10. await sleep(1000);
  11. }
  12. client.close();
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement