Advertisement
Guest User

Solución

a guest
Jan 28th, 2017
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let check = setInterval(function() {
  2.   if (new Date() >= channel.trackertimer + 900000) {
  3.     const filename = `${channel.tracker}-${channel.id}-${channel.trackertimer}.txt`;
  4.     const userfriendly = `${msg.author.username}-#${client.channels.get(channel.id).name}.txt`;
  5.     fs.access(filename, fs.constants.R_OK | fs.constants.W_OK, (err) => {
  6.       if (err) return;
  7.       clearInterval(check);
  8.       msg.author.sendFile(filename, userfriendly, `The time ended! There's your file for ${channel}.`)
  9.        .then(() => {
  10.          channel.tracking = false;
  11.          channel.tracker = null;
  12.          channel.trackertimer = null;
  13.          fs.unlink(filename, (err) => {
  14.            if (err) throw err;
  15.          });
  16.        });
  17.    });
  18.  }
  19. }, 1000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement