Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let check = setInterval(function() {
- if (new Date() >= channel.trackertimer + 900000) {
- const filename = `${channel.tracker}-${channel.id}-${channel.trackertimer}.txt`;
- const userfriendly = `${msg.author.username}-#${client.channels.get(channel.id).name}.txt`;
- fs.access(filename, fs.constants.R_OK | fs.constants.W_OK, (err) => {
- if (err) return;
- clearInterval(check);
- msg.author.sendFile(filename, userfriendly, `The time ended! There's your file for ${channel}.`)
- .then(() => {
- channel.tracking = false;
- channel.tracker = null;
- channel.trackertimer = null;
- fs.unlink(filename, (err) => {
- if (err) throw err;
- });
- });
- });
- }
- }, 1000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement