Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
483
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 23.45 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. set_time_limit(0);
  5. ini_set('display_errors', 'on');
  6.  
  7. /* --- Varibles and Config Info --- */
  8.  
  9. $config = array(
  10.         'server' => 'irc.toribash.com',
  11.         'port'   => 6667,
  12.         'name'   => 'Kozbot',
  13.         'nick'   => 'Kozzy',
  14.         'pass'   => 'koz',
  15.        
  16.        
  17.         'channel' => '#koz',
  18.         'channel2' => '#dat',  
  19.         'logging' => false,
  20.         'warning' => false,
  21. );
  22.  
  23.  
  24. /* --- IRCBot Class --- */
  25.  
  26. class IRCBot {
  27.  
  28.         //This is going to hold our TCP/IP connection
  29.         var $socket;
  30.  
  31.         //This is going to hold all of the messages both server and client
  32.         var $ex = array();    
  33.         //var $logging = true;
  34.  
  35.         /*
  36.          Construct item, opens the server connection, logs the bot in
  37.          @param array
  38.         */
  39.  
  40.         function __construct($config)
  41.         {
  42.                 $this->socket = fsockopen($config['server'], $config['port']);
  43.                 $this->login($config);
  44.                 $this->main($config);
  45.         }
  46.  
  47.         /*
  48.          Logs the bot in on the server
  49.          @param array
  50.         */
  51.  
  52.         function login($config)
  53.         {
  54.                 $this->send_data('USER', $config['nick'].' KozEnko '.$config['nick'].' :'.$config['name']);
  55.                 $this->send_data('NICK', $config['nick']);
  56.                 $this->send_data('NICKSERV', 'identify pass');    
  57. sleep(1);
  58.                 $this->join_channel($config['channel']);
  59.                 $this->join_channel($config['channel2']);
  60.                  if($config['logging']) {
  61.                         $date = date("n-j-y");
  62.                         $time = date('h:i:s A');
  63.                         $logfile = fopen("$date-log.html","a");
  64.                         fwrite($logfile,"<br/>**************** Logging Started at $time ****************<br/>");
  65.                         fclose($logfile);
  66.                        
  67.                         //Warn that logging has been enabled
  68.                          if($config['warning']) {
  69.                                 $this->send_data('PRIVMSG '.$config['channel'].' :', "Chat Logging has been [Enabled]");
  70.                         }
  71.                  }
  72.         }
  73.  
  74.         /*
  75.          This is the workhorse function, grabs the data from the server and displays on the browser
  76.         */
  77.  
  78.         function main($config)
  79.         {            
  80.                 $data = fgets($this->socket, 256);
  81.                
  82.                 echo nl2br($data);
  83.                
  84.                 flush();
  85.  
  86.                 $this->ex = explode(' ', $data);
  87.                
  88.                 if($this->ex[0] == 'PING')
  89.                 {
  90.                         $this->send_data('PONG', $this->ex[0]); //Plays ping-pong with the server to stay connected.
  91.                 }
  92.                
  93.                  //Logs the chat
  94.                 if($config['logging'])
  95.                 {
  96.                     $logtxt = $this->filter_log($this->ex[1], $this->ex[2], $this->ex[0], $this->get_msg($this->ex)); //Gets human readable text from irc data
  97.                     if($logtxt != null) { //Writes to log if it is a message
  98.                         $date = date("n-j-y");
  99.                         $logfile = fopen("$date-log.html","a");
  100.                         fwrite($logfile,"$logtxt<br />");
  101.                         fclose($logfile);  
  102.                     }
  103.                 }
  104.         $command = str_replace(array(chr(10), chr(13)), '', $this->ex[3])." ".$this->ex[0];
  105.  
  106.         switch($command) {
  107. //enseñar
  108.             case ':Kozzy= '.$this->ex[0]:
  109.                 $cmd = explode("Kozzy",$this->ex[0]);
  110.                 $cmd[0] = trim($nick[0], ":");
  111. //jour
  112.  
  113.             case ':!jour '.$this->ex[0]:
  114.                 $time = date('l jS \of F Y h:i:s A');
  115.                 $this->send_data('PRIVMSG', $this->ex[2].' :'.$time);
  116.                 break; 
  117. //hora
  118.             case ':!hora '.$this->ex[0]:
  119.                 $time = date('h:i:s A');
  120.                 $this->send_data('PRIVMSG', $this->ex[2].' :'.$time);
  121.                 break; 
  122.  
  123. //dia
  124.             case ':!dia '.$this->ex[0]:
  125.                 $date = date("j-n-y");
  126.                 $this->send_data('PRIVMSG', $this->ex[2].' :'.$date);
  127.                 break; 
  128. //change nick
  129.             case ':!nik :Koz!Koz@Enko.ar ':
  130.                 $nik = "";
  131.                 for($i=4; $i <= (count($this->ex)); $i++) { $nik .= $this->ex[$i]." "; }
  132.                 $this->send_data('NICK '.$nik);
  133.                 break;
  134. //listacmd
  135.             case ":!cmd ".$this->ex[0] :
  136.                 $nick = explode("!",$this->ex[0]);
  137.                 $nick[0] = trim($nick[0], ":");
  138.                 $this->send_data("PRIVMSG ".$nick[0]. " !say [msg] - !me [msg] - !sayxquery [msg] - !sayxchan [msg]");
  139.                 $this->send_data("PRIVMSG ".$nick[0]. " WTF - back - chau - !frase - !hora - !dia - !jour - !version");
  140.                 $this->send_data("PRIVMSG ".$nick[0]. " !pegar - !mear - !matar - !cagar - !fag - !fail - !amar - !odiar - !morder - !epic - !suck - !lol - !cookie - !escupir - !chupar - !kick");
  141.                 $this->send_data("PRIVMSG ".$nick[0]. " !ocmd ");
  142.                 break;
  143. //cmds owner
  144.             case ':!ocmd :Koz!Koz@Enko.ar':
  145.                 $nick = explode("!",$this->ex[0]);
  146.                 $nick[0] = trim($nick[0], ":");
  147.                 $this->send_data("PRIVMSG ".$nick[0]. " !cmd ");
  148.                 $this->send_data("PRIVMSG ".$nick[0]. " ident ");
  149.                 $this->send_data("PRIVMSG ".$nick[0]. " !join !restart !shutdown GTFO! ");     
  150.                 $this->send_data("PRIVMSG ".$nick[0]. " !kick !ban !unban !bk !topic");
  151.                 $this->send_data("PRIVMSG ".$nick[0]. " !owner !deowner !deprotect !protect !op !deop !hop !dehop !voice !devoice !aown !mute !unmute");
  152.                 break;
  153. //names
  154.             case ':!names :Koz!Koz@Enko.ar':
  155.                 $this->send_data('NAMES', $this->ex[2]);
  156.                 break;
  157. //invert
  158.             case ':!invert '.$this->ex[0]:
  159.                 $message = "";
  160.                 for($i=4; $i <= (count($this->ex)); $i++) { $message .= $this->ex[$i].""; }
  161.                 $messagge = strrev($message);
  162.                 $this->send_data('PRIVMSG', $this->ex[2].' :'.$messagge);
  163.                 break;
  164. //random frases
  165.             case ':!frase '.$this->ex[0]:
  166.                  $input = array ("you suck", "you are epic", "try again", "I am better than you", "Koz is better that you","master5000 is the overlord of wibbles etc");
  167.                  $rand_keys = array_rand($input, 1);
  168.                  $this->send_data('PRIVMSG', $this->ex[2]." :\x01ACTION says ".$input[$rand_keys]);
  169.                  break;    
  170. //servant
  171.             case ':servant? '.$this->ex[0]:
  172.                 $this->send_data('PRIVMSG', $this->ex[2]." Yes sir?");
  173.                 break;
  174. //nickserv
  175.             case ':ident :Koz!Koz@Enko.ar':
  176.                 $this->send_data('NICKSERV', 'identify poliupoliu');
  177.                 $this->send_data("PRIVMSG ".$this->ex[2], "Identified");
  178.                 break;
  179. //nick change
  180.             case ':!nick :Koz!Koz@Enko.ar':
  181.                 $nik = "";
  182.                 for($i=4; $i <= (count($this->ex)); $i++) { $nik .= $this->ex[$i]." "; }
  183.                 $this->send_data('NICK' .$nik);
  184.                 break;
  185. // say & me & sayxquery & sayxhan
  186.             case ':!me '.$this->ex[0]:
  187.                 $me = "";
  188.                 for($i=4; $i <= (count($this->ex)); $i++) { $me .= $this->ex[$i]." "; }
  189.                 $this->send_data('PRIVMSG', $this->ex[2]." :\x01ACTION ".$me);
  190.                 break;
  191.                         case ':!sayxchan':
  192.                                 $message = "";
  193.                                 for($i=5; $i <= (count($this->ex)); $i++)
  194.                                 {
  195.                                         $message .= $this->ex[$i]." ";
  196.                                 }
  197.                                
  198.                                 $this->send_data('PRIVMSG '.$this->ex[2].' :', $message);
  199.                                 break;          
  200.             case ':!say '.$this->ex[0]:
  201.                 $message = "";
  202.                 for($i=4; $i <= (count($this->ex)); $i++) { $message .= $this->ex[$i]." "; }
  203.                 $this->send_data('PRIVMSG', $this->ex[2].' :'.$message);
  204.                 break;
  205.             case ':!sayxquery '.$this->ex[0]:
  206.                  $nick = explode("!",$this->ex[0]);
  207.                 $nick[0] = trim($nick[0], ":");
  208.                 $query = "";
  209.                 for($i=4; $i <= (count($this->ex)); $i++) { $query .= $this->ex[$i]." "; }
  210.                 $this->send_data('PRIVMSG',$nick[0].' :'.$query);
  211.                 break;
  212.             case ':!sayxchan '.$this->ex[0]:
  213.                 $message = "";
  214.                 for($i=4; $i <= (count($this->ex)); $i++) { $message .= $this->ex[$i]." "; }
  215.                 $this->send_data('PRIVMSG ',$message);
  216.                 break;
  217. //version
  218.             case ':!version '.$this->ex[0]:
  219.                 $version = " 2.8 beta 2";
  220.                 $this->send_data('PRIVMSG', $this->ex[2].' :'.$version);
  221.                 break;
  222.             case ':VERSION '.$this->ex[0]:
  223.                 $version = " 2.8 beta 2";
  224.                 $this->send_data('TOPIC', $this->ex[2].' :'.$version);
  225.                 break;
  226. //topic
  227.             case ':!topic '.$this->ex[0]:
  228.                 $topic = "";
  229.                 for($i=4; $i <= (count($this->ex)); $i++) { $topic .= $this->ex[$i]." "; }
  230.                 $this->send_data('TOPIC', $this->ex[2].' :'.$topic);
  231.                 break;
  232. //epic commands
  233.             case ':!kick '.$this->ex[0]:
  234.                 $kick = "";
  235.                 for($i=4; $i <= (count($this->ex)); $i++) { $kick .= $this->ex[$i]." "; }
  236.                 $this->send_data('PRIVMSG', $this->ex[2]." :\x01ACTION kicks in the balls to".$kick);
  237.                 break;
  238.             case ':!suck '.$this->ex[0]:
  239.                 $suck = "";
  240.                 for($i=4; $i <= (count($this->ex)); $i++) { $suck .= $this->ex[$i]." "; }
  241.                 $this->send_data('PRIVMSG', $this->ex[2]." you suck ".$suck);
  242.                 break;
  243.             case ':!cookie '.$this->ex[0]:
  244.                 $cookie = "";
  245.                 for($i=4; $i <= (count($this->ex)); $i++) { $cookie .= $this->ex[$i]." "; }
  246.                 $this->send_data('PRIVMSG', $this->ex[2]." :\x01ACTION gives a cookie to ".$cookie);
  247.                 break;         
  248.             case ':!cagar '.$this->ex[0]:
  249.                 $cagar = "";
  250.                 for($i=4; $i <= (count($this->ex)); $i++) { $cagar .= $this->ex[$i]." "; }
  251.                 $this->send_data('PRIVMSG', $this->ex[2]." :\x01ACTION se caga en ".$cagar);
  252.                 break;
  253.             case ':!mear '.$this->ex[0]:
  254.                 $mear = "";
  255.                 for($i=4; $i <= (count($this->ex)); $i++) { $mear .= $this->ex[$i]." "; }
  256.                 $this->send_data('PRIVMSG', $this->ex[2]." :\x01ACTION se hecha un cloro en la cara de ".$mear);
  257.                 break;
  258.             case ':!pegar '.$this->ex[0]:
  259.                 $pegar = "";
  260.                 for($i=4; $i <= (count($this->ex)); $i++) { $pegar .= $this->ex[$i]." "; }
  261.                 $this->send_data('PRIVMSG', $this->ex[2]." :\x01ACTION le pega en la cara a ".$pegar." tan fuerte que le rompe la nariz");
  262.                 break;
  263.             case ':!matar '.$this->ex[0]:
  264.                 $matar = "";
  265.                 for($i=4; $i <= (count($this->ex)); $i++) { $matar .= $this->ex[$i]." "; }
  266.                 $this->send_data('PRIVMSG', $this->ex[2]." :\x01ACTION le pega un tiro a ".$matar);
  267.                 break;
  268.             case ':!odiar'.$this->ex[0]:
  269.                 $odiar = "";
  270.                 for($i=4; $i <= (count($this->ex)); $i++) { $odiar .= $this->ex[$i]." "; }
  271.                 $this->send_data('PRIVMSG', $this->ex[2]." :\x01ACTION odia a ".$odiar);
  272.                 break;
  273.             case ':!amar '.$this->ex[0]:
  274.                 $amar = "";
  275.                 for($i=4; $i <= (count($this->ex)); $i++) { $amar .= $this->ex[$i]." "; }
  276.                 $this->send_data('PRIVMSG', $this->ex[2]." :\x01ACTION ama a ".$amar);
  277.                 break;
  278.             case ':!fail '.$this->ex[0]:
  279.                 $fail = "";
  280.                 for($i=4; $i <= (count($this->ex)); $i++) { $matar .= $this->ex[$i]." "; }
  281.                 $this->send_data('PRIVMSG', $this->ex[2]." :\x01ACTION eres un fail ".$fail);
  282.                 break;
  283.             case ':!fag '.$this->ex[0]:
  284.                 $fag = "";
  285.                 for($i=4; $i <= (count($this->ex)); $i++) { $fag .= $this->ex[$i]." "; }
  286.                 $this->send_data('PRIVMSG', $this->ex[2]." :\x01ACTION eres un puto fag ".$fag."!");
  287.                 break;
  288.             case ':!morder '.$this->ex[0]:
  289.                 $morder = "";
  290.                 for($i=4; $i <= (count($this->ex)); $i++) { $morder .= $this->ex[$i]." "; }
  291.                 $this->send_data('PRIVMSG', $this->ex[2]." :\x01ACTION le muerde el culo a ".$morder."!");
  292.                 break;
  293.             case ':!epic '.$this->ex[0]:
  294.                 $epic = "";
  295.                 for($i=4; $i <= (count($this->ex)); $i++) { $epic .= $this->ex[$i]." "; }
  296.                 $this->send_data('PRIVMSG', $this->ex[2]." eres epic ".$epic."!");
  297.                 break;
  298.             case ':!lol '.$this->ex[0]:
  299.                 $lol = "";
  300.                 for($i=4; $i <= (count($this->ex)); $i++) { $lol .= $this->ex[$i]." "; }
  301.                 $this->send_data('PRIVMSG', $this->ex[2]." se le rie en la cara a ".$lol."!");
  302.                 break;
  303.             case ':!escupir '.$this->ex[0]:
  304.                 $esc = "";
  305.                 for($i=4; $i <= (count($this->ex)); $i++) { $esc .= $this->ex[$i]." "; }
  306.                 $this->send_data('PRIVMSG', $this->ex[2]." :\x01ACTION le encaja un terrible garzo en la cara a ".$esc."!");
  307.                 break;
  308.             case ':!chupar '.$this->ex[0]:
  309.                 $esc = "";
  310.                 for($i=4; $i <= (count($this->ex)); $i++) { $esc .= $this->ex[$i]." "; }
  311.                 $this->send_data('PRIVMSG', $this->ex[2]." Hacelo vos!");
  312.                 break;
  313. //basics commands
  314.             case ':Kozzy '.$this->ex[0]:
  315.                 $nick = explode("!",$this->ex[0]);
  316.                 $nick[0] = trim($nick[0], ":");              
  317.                 $this->send_data('PRIVMSG', $this->ex[2]." que sucede ".$nick[0]);
  318.                 break;
  319.  
  320.             case ':WTF '.$this->ex[0]:
  321.                 $WTF = "Dunno";
  322.                 $this->send_data('PRIVMSG', $this->ex[2].' :'.$WTF);
  323.                 break;
  324.             case ':Ping '.$this->ex[0]:
  325.                 $WTF = "Pong";
  326.                 $this->send_data('PRIVMSG', $this->ex[2].' :'.$WTF);
  327.                 break;
  328.             case ':ping '.$this->ex[0]:
  329.                 $WTF = "Pong";
  330.                 $this->send_data('PRIVMSG', $this->ex[2].' :'.$WTF);
  331.                 break;
  332.             case ':!putear '.$this->ex[0]:
  333.                 $putear = "La reconcha de la lora y la puta madre que te re mil re parió!";
  334.                 $puteo = "hijo de un trasatlantico lleno de travestis!";
  335.                  
  336.                 $this->send_data('PRIVMSG', $this->ex[2].' :'.$putear);
  337.                 $this->send_data('PRIVMSG', $this->ex[2].' :'.$puteo);
  338.                 break;
  339.             case ':back '.$this->ex[0]:
  340.                 $Back = "Puff! Cuanto tiempo! e.e";
  341.                 $this->send_data('PRIVMSG', $this->ex[2].' :'.$Back);
  342.                 break;
  343.             case ':cya '.$this->ex[0]:
  344.                 $Cya = "Hasta luego!";
  345.                 $this->send_data('PRIVMSG', $this->ex[2].' :'.$Cya);
  346.                 break;
  347. //mute
  348.             case ':!mute :Koz!Koz@Enko.ar':
  349.                 $m = "+m";
  350.                 $this->send_data('MODE ', $this->ex[2].' :'.$m);
  351.                 break;
  352.             case ':!unmute :Koz!Koz@Enko.ar':
  353.                 $mm = "-m";
  354.                 $this->send_data('MODE ', $this->ex[2].' :'.$mm);
  355.                 break;
  356.                
  357. // joins & quits
  358.             case ':!join :Koz!Koz@Enko.ar':
  359.                 $this->join_channel($this->ex[4]);
  360.                 break;
  361.             case ':!part :Koz!Koz@Enko.ar':
  362.                 $byee = "Cya guys!";
  363.                 $this->send_data('PART', $this->ex[2]);
  364.                 break;
  365.             case ':!autodestruir :Koz!Koz@Enko.ar':
  366.                 $auto3 = "Auto destruyendo en 3";
  367.                 $auto2 = "Auto destruyendo en 2";
  368.                 $auto1 = "Auto destruyendo en 1";
  369.                 $auto0 = "Auto destruyendo en 0";
  370.                 $boom = "BOOM";
  371.                            
  372.                 $this->send_data('PRIVMSG', $this->ex[2].' :'.$auto3);
  373.                 sleep(1);
  374.                 $this->send_data('PRIVMSG', $this->ex[2].' :'.$auto2);
  375.                 sleep(1);
  376.                 $this->send_data('PRIVMSG', $this->ex[2].' :'.$auto1);
  377.                 sleep(1);
  378.                 $this->send_data('PRIVMSG', $this->ex[2].' :'.$auto0);
  379.                 $this->send_data('PRIVMSG', $this->ex[2].' :'.$aboom);
  380.  
  381.  
  382.                 $this->send_data('PART', $this->ex[2]. " x|");
  383.                 break;
  384.             case ':GTFO! :Koz!Koz@Enko.ar':
  385.                 $shutup = "Ok Koz =(";
  386.                 $this->send_data('PRIVMSG', $this->ex[2].' :'.$shutup);
  387.                 $this->send_data('QUIT', ' =,(');
  388.                 break;
  389.             case ':!restart :Koz!Koz@Enko.ar':
  390.                 if($config['warning']) {
  391.                     $this->send_data('PRIVMSG '.$config['channel'].' :', "Chat Logging has been [Disabled]");
  392.                 }
  393.                 echo "<meta http-equiv=\"refresh\" content=\"3\">";
  394.                 if($config['logging']) {
  395.                     $date = date("n-j-y");
  396.                     $time = date('h:i:s A');
  397.                     $logfile = fopen("$date-log.html","a");
  398.                     fwrite($logfile,"<br/>**************** Logging Ended at $time ****************<br/>");
  399.                     fclose($logfile);
  400.                 }      
  401.                 exit;
  402.        
  403.             case ':!shutdown :Koz!Koz@Enko.ar':
  404.            
  405.                 if($config['warning']) {
  406.                     $this->send_data('PRIVMSG '.$config['channel'].' :', "Chat Logging has been [Disabled]");
  407.                 }
  408.                 if($config['logging']) {
  409.                     $date = date("n-j-y");
  410.                     $time = date('h:i:s A');
  411.                     $logfile = fopen("$date-log.html","a");
  412.                     fwrite($logfile,"<br/>**************** Logging Ended at $time ****************<br/>");
  413.                     fclose($logfile);
  414.                 }
  415.                 exit;
  416. //register chanel
  417.             case ':!register :Koz!Koz@Enko.ar':
  418.                 $pass = "poliupoliu kozzy";
  419.                 $this->send_data('CHANSERV register', $this->ex[2]." ".$pass);
  420.                 break;
  421. //kick
  422.             case ':!kickk :Koz!Koz@Enko.ar':
  423.                 $this->kick_user($this->ex[2], $this->ex[4]);
  424.                 break;
  425.  
  426. //ban
  427.             case ':!ban :Koz!Koz@Enko.ar':
  428.                 $this->ban_user($this->ex[2], $this->ex[4]);
  429.                 break;
  430.             case ':!unban :Koz!Koz@Enko.ar':
  431.                 $this->ban_user($this->ex[2], $this->ex[4], false);
  432.                 break;
  433. //kick ban
  434.             case ':!bk :Koz!Koz@Enko.ar':
  435.                  $this->ban_user($this->ex[2], $this->ex[4]);
  436.                  $this->kick_user($this->ex[2], $this->ex[4]);
  437.                  break;
  438. //auto-owner
  439.             case ':!aown :Koz!Koz@Enko.ar':
  440.                 $pass = "poliupoliu";
  441.                 $this->send_data('NICKSERV', 'identify poliupoliu');
  442.                 $this->send_data('CHANSERV', " Identify #koz ".$pass);
  443.                 sleep(1);
  444.                 $this->send_data('CHANSERV', " owner");
  445.                
  446.                 break; 
  447. //owner multi
  448.             case ':!own :Koz!Koz@Enko.ar':
  449.                 $own = "";
  450.                 for($i=4; $i <= (count($this->ex)); $i++) { $own .= $this->ex[$i]." "; }
  451.                 $this->send_data('MODE', $this->ex[2]." +qqqqqqqqqqqqqq ".$own);
  452.                 break;
  453.             case ':!deown :Koz!Koz@Enko.ar':
  454.                 $own = "";
  455.                 for($i=4; $i <= (count($this->ex)); $i++) { $own .= $this->ex[$i]." "; }
  456.                 $this->send_data('MODE', $this->ex[2]." -qqqqqqqqqqqqqq ".$own);
  457.                 break;             
  458. //admin multi
  459.             case ':!admin :Koz!Koz@Enko.ar':
  460.                 $adm = "";
  461.                 for($i=4; $i <= (count($this->ex)); $i++) { $adm .= $this->ex[$i]." "; }
  462.                 $this->send_data('MODE', $this->ex[2]." +aaaaaaaaaaaaaa ".$adm);
  463.                 break;
  464.             case ':!deop :Koz!Koz@Enko.ar':
  465.                 $adm = "";
  466.                 for($i=4; $i <= (count($this->ex)); $i++) { $adm .= $this->ex[$i]." "; }
  467.                 $this->send_data('MODE', $this->ex[2]." -aaaaaaaaaaaaaa ".$adm);
  468.                 break;
  469. //op multi
  470.             case ':!op :Koz!Koz@Enko.ar':
  471.                 $op = "";
  472.                 for($i=4; $i <= (count($this->ex)); $i++) { $op .= $this->ex[$i]." "; }
  473.                 $this->send_data('MODE', $this->ex[2]." +ooooooooooooo ".$op);
  474.                 break;
  475.             case ':!deop :Koz!Koz@Enko.ar':
  476.                 $op = "";
  477.                 for($i=4; $i <= (count($this->ex)); $i++) { $op .= $this->ex[$i]." "; }
  478.                 $this->send_data('MODE', $this->ex[2]." -ooooooooooooo ".$op);
  479.                 break;             
  480. //hop multi
  481.             case ':!hop :Koz!Koz@Enko.ar':
  482.                 $hop = "";
  483.                 for($i=4; $i <= (count($this->ex)); $i++) { $hop .= $this->ex[$i]." "; }
  484.                 $this->send_data('MODE', $this->ex[2]." +hhhhhhhhhhhh ".$hop);
  485.                 break;
  486.             case ':!dehop :Koz!Koz@Enko.ar':
  487.                 $hop = "";
  488.                 for($i=4; $i <= (count($this->ex)); $i++) { $hoc .= $this->ex[$i]." "; }
  489.                 $this->send_data('MODE', $this->ex[2]." -hhhhhhhhhhhh ".$hop);
  490.                 break;
  491. // voice multi
  492.             case ':!voice :Koz!Koz@Enko.ar':
  493.                 $voc = "";
  494.                 for($i=4; $i <= (count($this->ex)); $i++) { $voc .= $this->ex[$i]." "; }
  495.                 $this->send_data('MODE', $this->ex[2]." +vvvvvvvvvvv ".$voc);
  496.                 break;
  497.             case ':!devoice :Koz!Koz@Enko.ar':
  498.                 $voc = "";
  499.                 for($i=4; $i <= (count($this->ex)); $i++) { $voc .= $this->ex[$i]." "; }
  500.                 $this->send_data('MODE', $this->ex[2]." -vvvvvvvvvvv ".$voc);
  501.                 break;
  502. //voice all
  503.  
  504.            
  505.  
  506. }
  507.         $this->main($config);
  508.     }
  509.  
  510.     /* --- IRCBot Class's Functions --- */
  511.  
  512.     function filter_log($type, $chan, $nick, $msg) {
  513.         $nick = ltrim($nick, ":");
  514.         $nick = substr($nick, 0, strpos($nick, "!"));
  515.         $msg = ltrim($msg, ":");
  516.  
  517.         if($type == "PRIVMSG") {
  518.             return date("[H:i]")." <".$nick."> ".$msg;
  519.         }
  520.         return null     ;
  521.     }
  522.  
  523.     function get_msg($n) {
  524.         $message = "";
  525.         for($i=$n; $i <= (count($this->ex)); $i++) { $message .= $this->ex[$i]." "; }
  526.         return $message;
  527.     }
  528.  
  529.     function send_data($cmd, $msg = null) {
  530.         if($msg != null) {
  531.             fputs($this->socket, $cmd.' '.$msg."\r\n");
  532.             echo '<strong>'.$cmd.' '.$msg.'</strong><br />';
  533.         } else {
  534.             fputs($this->socket, $cmd."\r\n");
  535.             echo '<strong>'.$cmd.'</strong><br />';
  536.         }
  537.     }
  538.  
  539.         function join_channel($channel) {
  540.         $this->send_data('JOIN', $channel);
  541.     }
  542.  
  543.  
  544.  
  545.  function ban_user($chan = "#DAT", $user = "Koz", $ban = true) {
  546.         if($ban) { $this->send_data('MODE', $chan.' +b '.$user);
  547.         } else { $this->send_data('MODE', $chan.' -b '.$user); }
  548.     }
  549.  
  550.  function kick_user($chan = "#DAT", $user = "Koz") {
  551.         $this->send_data('KICK ' . $chan, $user);
  552. }
  553.  
  554.  
  555. function build($offset) {
  556.           $out = "";
  557.         for($i=($offset); $i<=(count($this->ex)-1); $i++) {
  558.             $out = $out.$this->ex[$i]." ";
  559.         }
  560.         return $out;
  561.     }
  562.  
  563. }
  564. $bot = new IRCBot($config);
  565. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement