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.
that is not implementated yet
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.
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.
that is not implementated yet
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