rendered paste body<?php
while (!$disconnect) {
include_once('Net/SmartIRC.php');
class weatherbot {
function text1(&$irc, &$data) {
$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel,'Yeah, Comando1');
}
function text2(&$irc, &$data) {
$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel,'Yeah, Comando2e');
}
function getnicks(&$irc, &$data) {
$irc->names('#pear');
while (1) { $resultarray = $irc->listenFor(SMARTIRC_TYPE_NAME); }
print_r($resultarray);
$total=count($resultarray);
echo "Total Nicks $resultarray";
}
}
$host = "irc.he.net";
$port = 6666;
$nick = "weather";
$chan = "#pear";
$bot = &new weatherbot( );
$irc = &new Net_SmartIRC( );
$irc->setUseSockets( TRUE );
$irc->registerActionhandler( SMARTIRC_TYPE_CHANNEL,'^Command1', $bot, 'text1' );
$irc->registerActionhandler( SMARTIRC_TYPE_CHANNEL,'^Command2', $bot, 'text2' );
$irc->registerActionhandler( SMARTIRC_TYPE_CHANNEL,'^getnicks', $bot, 'getnicks' );
$irc->connect( $host, $port );
//$irc->setDebug(SMARTIRC_DEBUG_ALL);
$irc->login( $nick, 'Weather bot', 0, $nick );
$irc->join( array( $chan ) );
$irc->listen( );
$irc->disconnect( );
}
?>