Login   Register  
PHP Classes
elePHPant
Icontem

File: MakeIrcBot.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of cobra90nj  >  XXXpROH4x0r  >  MakeIrcBot.php  >  Download  
File: MakeIrcBot.php
Role: Example script
Content type: text/plain
Description: The client
Class: XXXpROH4x0r
Implements an IRC client bot
Author: By
Last change:
Date: 5 years ago
Size: 1,873 bytes
 

Contents

Class file image Download
<?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($ConnectGet4096)) {
        
        
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;
        }
    }
    
}