Menu

Uptime Capability

Help
Aidan
2003-08-14
2004-08-27
  • Aidan

    Aidan - 2003-08-14

    Is there any built in methods regarding the bots uptime (IE. time connected to server?)

    Easy to code, but I don't want to reinvent the wheel.

     
    • Mirco Bauer

      Mirco Bauer - 2003-08-14

      that is not implementated yet

       
    • Nobody/Anonymous

      Put this on your top of script (bot.php)

      //--------PHP----CODE--------
      $debut = explode(" ",microtime());
      $debut = $debut[1]+$debut[0];
      //--------END-----------

      add a function to your class bot:

      //--START------
          function uptime(&$irc, &$data){
          global $debut;

          $fin = explode(" ",microtime());
          $fin = $fin[1]+$fin[0];
          $temps_passe = $fin-$debut;
          $irc->message(SMARTIRC_TYPE_QUERY, $data->channel, "Uptime: ".$temps_passe);
      }
      //-End--------

      And declare the function:
      $irc->registerActionhandler(SMARTIRC_TYPE_CHANNEL, '^!uptime', $bot, 'uptime');

      Sorry for my bad english. (i'm french)

      Good bye

       

Log in to post a comment.