sodapop112 Posted April 9, 2007 Share Posted April 9, 2007 hi how would i make it so when i say like !mybot say hia it would say hia? this is the bot now: (its not mine) <?php // define your variables $host = "whatever"; $port=6667; $nick="sodabot2"; $ident="sodabot2"; $chan="#woo"; $readbuffer=""; $realname ="sodabot2"; // open a socket connection to the IRC server $fp = fsockopen($host, $port, $erno, $errstr, 30); // print the error if ther is no connection if (!$fp) { echo $errstr." (".$errno.")<br />\n"; } else { // write data through the socket to join the channel fwrite($fp, "NICK ".$nick."\r\n"); fwrite($fp, "USER ".$ident." ".$host." bla :".$realname."\r\n"); fwrite($fp, "JOIN :".$chan."\r\n"); // write data through the socket to print text to the channel fwrite($fp, "PRIVMSG ".$chan." :All other bots are inferior to me. \r\n"); // loop through each line to look for ping 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"); } } fclose($fp); } ?> Link to comment https://forums.phpfreaks.com/topic/46212-irc-bot-help/ Share on other sites More sharing options...
clown[NOR] Posted April 9, 2007 Share Posted April 9, 2007 i actually have no clue.. but i'll give it a try make it listen for the command "!mybot say", and then if it picks that up make it store whatever comes after "say" to a variable... then from what i can see you do something like this: $say <-- the variable that holds the info fwrite($fp, "PRIVMSG :".$chan." :".$say,"\r\n"); or something like that...hehe =) Link to comment https://forums.phpfreaks.com/topic/46212-irc-bot-help/#findComment-224704 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.