rendered paste body<?php
// Prevent PHP from stopping the script after 30 sec
ignore_user_abort(TRUE);
set_time_limit(0);
// Opening the socket to the Quakenet network
$socket = fsockopen("us.quakenet.org", 6667);
// Send auth info
fputs($socket,"USER R7 fracs.net Ruthless :Ruth\n");
fputs($socket,"NICK R7\n");
fputs($socket,"PRIVMSG Q@CServe.quakenet.org AUTH --- ---");
fputs($socket,"JOIN #the.ruthless\n");
fputs($socket,"MODE R7 +x\n");
// Force an endless while
while($data = fgets($socket, 2056)) {
echo $data;
// Separate all data
$ex = explode(' ', $data);
// Send PONG back to the server
if($ex[0] == "PING"){
fputs($socket, "PONG ".$ex[1]."\n");
}
// Say something in the channel
$command = trim($ex[3]);
if ($command == ":!say" && count($ex) > 4) {
//message
$to_send = "";
for($i = 5;$i < count($ex);$i++){ $to_send .= trim($ex[$i]); }
fputs($socket, "PRIVMSG ".$ex[4]." :".$to_send."\n");
}
//Changes nick
if ($command == ":!nick") {
fputs($socket, "NICK ".$ex[4]."\n");
}
if ($command == ":!join") {
fputs($socket, "JOIN #the.ruthless\n");
}
// To quit the bot
if($command == ":!quit"){
fputs($socket,"QUIT :lolquitmsg\n");
die();
}
}
?>