Location: PHPKode > scripts > XXXpROH4x0r > xxxproh4x0r-2-0/MakeIrcBot.php
<?php

/**
 * Class for using bot
 * 
 * @Package BOT IRC => Client
 * @Name XXXpROH4x0r
 * @Author cobra90nj <cobra90nj[at]gmail[dot]com>
 * @License http://www.gnu.org/licenses/gpl-3.0.html GNU Public License
 * @Version 2.0
 */

include_once('proxy_design/PrototypeBotFunction.php');
include_once('proxy_design/ConfigIrcBot.php');

$PrototypeFunc  = new PrototypeFunction();
// Edit with ConfigBot('Name of bot', 'Name of server irc', '#Name of name channel');
$ParamToConnect = new ConfigBot('XXXpROH4x0r', '', '');
$ParamsConnect  = $ParamToConnect->ParamPublic();
$ConnectGet     = $PrototypeFunc->ConnectToIrc($ParamsConnect);

while (1) {

	while ($Response = fgets($ConnectGet, 4096)) {
		
		flush();

		$LastCommand     = str_replace(array(chr(10), chr(13)), '', $ExplodeResponse[3]);
		$ExplodeResponse = explode(' ', $Response);

		// uncomment after linea if you want chat log
		// $PrototypeFunc->LogChannel($Response);

		switch (true) {
			
			case (eregi('PING', $ExplodeResponse[0])):
				fwrite($ConnectGet, "PONG :{$ExplodeResponse[1]}\r\n");
				fwrite($ConnectGet, "JOIN {$ParamsConnect[2]}\r\n");
				break;
				
			case (eregi(':-makeurl', $LastCommand)):
				$UrlShort = $PrototypeFunc->MakeTinyUrl($ExplodeResponse[4]);
			
				fwrite($ConnectGet, "PRIVMSG {$ParamsConnect[2]} $UrlShort\r\n");
				break;
				
			case (eregi(':-opme', $ExplodeResponse[3])):
			
				if ($PrototypeFunc->MakeAnOp($ExplodeResponse[4], $ExplodeResponse[5])) {
					fwrite($ConnectGet, "MODE {$ParamsConnect[2]} +o {$ExplodeResponse[4]}\r\n");
				}
				else {
					fwrite($ConnectGet, "PRIVMSG {$ParamsConnect[2]} TiPwN0\r\n");
				}
				break;
				
			case (eregi(':-deopme', $ExplodeResponse[3])):
				fwrite($ConnectGet, "MODE {$ParamsConnect[2]} -o {$ExplodeResponse[4]}\r\n");
				break;
		}
	}
	
}
Return current item: XXXpROH4x0r