How to create uptime timer in Discord JS?

  • 0
    I have a bot on Discord JS
    How can I make an Uptime timer from the start of the bot?
    JavaScript Anonymous, Feb 9, 2019

  • 1 Answers
  • 0
    you can use the property . uptime - it returns the time in milliseconds since the last time the bot entered the READY state (that is, the time elapsed since the last bot started): < br />


    var creationDate = Date.now () - client.uptime;



    if you want to know the date when the bot account was created, you can use the property . createdAt :



    var creationDate = client.user.createdAt;



    if you want to know when any of the files was created, you can use the function. stat (path [, options], callback) :

    var fs = require('fs');
    fs.stat('путь_к_файлу', (err, stat) => {
    if(err) throw(err);
    var creationDate = stat.birthtime; // ( * )
    })
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!