Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP IRC Bot - Wait for 001
    primarykey
    data
    text
    <p>Okay. I know the problem, and I'll try to describe it, but I cannot for the life of me find the answer, to the question.</p> <p>Okay, so, my bot will connect to the server fine. But this specific server you have to wait for this: </p> <pre><code>:vervet.foonetic.net 001 Eve :Welcome to the Foonetic IRC Network Eve!~Eve@*-*-*-*.*.*.*.net&lt;br /&gt; :vervet.foonetic.net 002 Eve :Your host is vervet.foonetic.net, running version Unreal3.2.8.1&lt;br /&gt; :vervet.foonetic.net 003 Eve :This server was created Thu Feb 24 2011 at 00:34:28 EST&lt;br /&gt; </code></pre> <p>Pay attention to the first line. "001". My bot needs to wait for that line to show up before it can run the JOIN command. It won't D: I've tried making a while(){} before the while(1){}, I've tried a do{}while(), and a simple if(). I am not the <strong>best</strong> PHP scripter so, bare with me. But yes, any help is appreciated.</p> <p>Here's my code.</p> <pre><code>&lt;?php set_time_limit(0); $conf = array('server' =&gt; 'irc.foonetic.net', 'port' =&gt; '6667', 'channel' =&gt; '#lingubender', 'nick' =&gt; 'Eve', 'name' =&gt; 'EveBot_1.0', 'description' =&gt; 'An IRC bot created by PHP scripter Kinz'); $replies = array('ver' =&gt; 'Eve 1.0', 'part' =&gt; 'Good-bye!', 'quit' =&gt; 'Shutting down. Talk to you all later!', 'regUsername' =&gt; 'example@yahoo.com', 'regPassword' =&gt; 'Example'); $socket = fsockopen($conf['server'], $conf['port']); fputs($socket, "USER ".$conf['nick'].' '.$conf['description'].' '.$conf['nick'].' :'.$conf['name']."\n"); fputs($socket, "NICK ".$conf['nick']."\n"); fputs($socket, "JOIN ".$conf['channel']."\n"); while(1) { while($data = fgets($socket, 128)) { echo nl2br($data); flush(); $grip = explode(' ', $data); if ($grip[0] == "PING") { fputs($socket, "PONG ".$grip[1]."\n"); } $chan = $grip[2]; $command = str_replace(array(chr(10), chr(13)), '', $grip[3]); strtolower($command); if ($command == ":eve" || $command == ":eve,") { fputs($socket, "PRIVMSG ".$chan." :Name recognition acknowledged.\n"); $ex = $grip[4]; strtolower($ex); switch($ex) { case "shutdown": fputs($socket, "QUIT ".$replies['quit']."\n"); break; case "version": fputs($socket, "PRIVMSG ".$chan[2]." :".$replies['ver'].' : '.$conf['description']." \n"); break; } } else { NULL; } } } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload