Jump to content

irc bot (probably simple) help


plushypop

Recommended Posts

hi i didnt make this bot, but i tried to add on the ability so that whenever somone says hello or !bot hello it will say 'hey whats up' but it won't start any help?  edit: it said the problem was on line 44 any help?

 

<?php

$host = "irc.abc.org";
$port=6667;
$nick="sodab0t";
$ident="sodab0t";
$chan="#argh";
$readbuffer="";
$realname ="sodab0t";


$fp = fsockopen($host, $port, $erno, $errstr, 30);


if (!$fp) {
    echo $errstr." (".$errno.")<br />\n";
} else {
    
    fwrite($fp, "NICK ".$nick."\r\n");
    fwrite($fp, "USER ".$ident." ".$host." bla :".$realname."\r\n");
    fwrite($fp, "JOIN :".$chan."\r\n");
    
    
    fwrite($fp, "PRIVMSG ".$chan." :All other bots are inferior to me. \r\n");
    
    
    
     while (!feof($fp)) {
         
        $line =  fgets($fp, 128);
        echo $line."\n";
        
        $line = explode(":ping ", $line);
        
        echo $line[0]."\n";

        if ($line[1]) {
            
            fwrite($fp, "PONG ".$line[1]."\r\n"); 
        
while ($line=fgets($fp)) 
echo $line; 

if (stripos($line, "PRIVMSG ".$chan " :hello ")>0) {
    
     fwrite($fp, "PRIVMSG ".$chan." :  hey, whats up \r\n");
{

}

  }
      
    }
    
    fclose($fp);
}
?> 

 

Link to comment
https://forums.phpfreaks.com/topic/46362-irc-bot-probably-simple-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.