HueyJib Posted August 19, 2008 Share Posted August 19, 2008 I wanna make a command that actually lets you do php from inside irc. For example, if I was in an irc channel and I typed: ! $words = "Hi"; echo $words; Then the bot would respond by saying Hi in the channel. How could I make a command like that? <?php set_time_limit(0); $conf['nick'] = 'Bot'; $conf['server'] = 'irc.gtanet.com'; $conf['port'] = 6667; $conf['ident'] = 'Bot'; $conf['realname'] = 'Bot'; $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); socket_connect($socket, $conf['server'], $conf['port']) || die("\nfailed conn\n"); socket_write($socket, 'NICK '.$conf['nick']."\r\n"); socket_write($socket, 'USER '.$conf['ident'].' email.com Simps :'.$conf['realname']."\r\n"); while(($line = socket_read($socket, 1024, PHP_NORMAL_READ)) !== false) { if (substr($line, 0, 5) == 'PING ') { socket_write($socket,'PONG '.substr($line,5)); continue; } else { echo $line; $ex = explode(' ', $line); if($ex[1] == '001') { socket_write($socket,'JOIN #gta'."\r\n"); } elseif($ex[1] == 'PRIVMSG') { unset($chan); list($nick,$addr) = explode('!',substr($ex[0],1)); $text = substr(rtrim(implode(' ', array_slice($ex, 3))), 1); if (substr($ex[2], 0, 1) == '#') { $chan = $ex[2]; } if ($text == '!die') { if($chan) { socket_write($socket,'PRIVMSG '.$chan.' :Bye'."\r\n"); } else { socket_write($socket,'PRIVMSG '.$nick.' :Dying'."\r\n"); } die("\nRequested\n"); } } } } ?> Link to comment https://forums.phpfreaks.com/topic/120291-irc-bot-help/ Share on other sites More sharing options...
Andy-H Posted August 19, 2008 Share Posted August 19, 2008 Usually it can be done by anyone with special ops in a channel. /bs say #channelName Hi, my name is buster... Link to comment https://forums.phpfreaks.com/topic/120291-irc-bot-help/#findComment-619743 Share on other sites More sharing options...
HueyJib Posted August 19, 2008 Author Share Posted August 19, 2008 No, that's a php bot, not a bot service bot. I wanna make that command for it. Link to comment https://forums.phpfreaks.com/topic/120291-irc-bot-help/#findComment-620019 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.