. * * * ************************************************************************ * * Bots/ModManager.class.php * * module manager bot... * */ class {$_NAME} extends Bot { private $uplink; private $modman; public function load($uplink, $old = false) { $this->uplink = $uplink; if(!$old) { $nick = "ModuleMan"; $ident = "modman"; $host = "Services.WebGamesNet.net"; $ip = "0::0"; $realname = "Module Manager"; $modes = "ioknISD"; $this->modman = $this->uplink->addUser($nick,$ident,$host,$ip,$modes,$realname); if(is_a($this->modman, "P10_User")) { $this->uplink->join($this->modman, "#opers", (P10_Channel::USERPRIV_OPED | P10_Channel::USERPRIV_VOICE)); $this->uplink->join($this->modman, "#dev", P10_Channel::USERPRIV_VOICE); } } else { $this->modman = $old; } ModCMD::bind($this, BIND_CHANMSG, "recive_privmsg"); ModCMD::bind($this, BIND_QUIT, "recive_quit"); ModCMD::bind($this, BIND_CTCP, "recive_ctcp"); } public function unload($rehash = false) { if($rehash) { return $this->modman; } else { $this->uplink->delUser($this->modman, "Bye."); } } public function recive_privmsg($user, $channel, $message) { if(!$user->getModes()->hasMode('o')) return 0; $exp=explode(" ",$message); switch (strtolower($exp[0])) { case "~loadmod": if(BotLoader::load($exp[1],$exp[2])) { $this->uplink->privmsg($this->modman, $channel, "done."); } else { $this->uplink->privmsg($this->modman, $channel, "error."); } break; case "~unloadmod": if(BotLoader::unload($exp[1])) { $this->uplink->privmsg($this->modman, $channel, "done."); } else { $this->uplink->privmsg($this->modman, $channel, "error."); } break; case "~rehash": if(BotLoader::rehash($exp[1])) { $this->uplink->privmsg($this->modman, $channel, "done."); } else { $this->uplink->privmsg($this->modman, $channel, "error."); } break; case "~list": foreach(BotLoader::listBots() as $name => $bot) { $this->uplink->privmsg($this->modman, $channel, $name); } break; case "~debug": $exp=explode(" ",$message,2); ob_start(); $ret = eval($exp[1]); $out = ob_get_contents(); ob_end_clean(); $lines = explode("\n",$out); for($i=0;$iuplink->privmsg($this->modman, $channel, $lines[$i]); } } $lines = explode("\n",$ret); for($i=0;$iuplink->privmsg($this->modman, $channel, $lines[$i]); } } break; } } public function recive_quit($user, $reason) { if($user === $this->modman) { $this->load($this->uplink); } } public function recive_ctcp($user, $target, $command, $text, $publicCtcp) { if(!$publicCtcp) { switch($command) { case"PING": $this->uplink->ctcp_reply($target, $user, "PING", ($text - (60*60*1337 + 42*60))); //1337 42 ftw! break; case"VERSION": $this->uplink->ctcp_reply($target, $user, "VERSION", "PHP-P10 Pack by pk910. Source: http://devserv.pk910.de/git/?p=PHP-P10.git"); break; case"TIME": $this->uplink->ctcp_reply($target, $user, "TIME", date('r')); break; case"FINGER": $this->uplink->ctcp_reply($target, $user, "FINGER", "PHP-P10 Pack (C) ".date('Y')." pk910. Visit us on irc://irc.webgamesnet.net/PHP"); break; } } } } ?>