Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- #if (!file_exists("quote.php")) { die("File missing. Find it!"); }
- include("quote.php");
- ## Set by the owner.
- $name = 'Machinedramon'; # The nick.
- $pass = 'dfsrevenge'; # The nick's pass.
- $join = '#1'; # Join on connect.
- $prefix = '>'; # Command prefix.
- $server = "irc.squaddiversity.com"; #Server to connect to.
- $port = 6667; # The server's port to use.
- $version = "v0.0.2"; # The Version of the bot.
- $master = ":Alias!is@not.known";# The master is who?
- global $socket;
- set_time_limit(0);
- $socket = fsockopen($server,$port);
- $x = 1;
- #:irc.codealife.com 353 Machinedramon = #1 :@rapacity ~Alias +Brenden +XTV-Info %
- #Andrew[Away] %Google +Sneaky +_ashLeyrhodeS_ &Rose +Neo|Desktop +Brenden|iPod +L
- #iquid- +Sbot +tiger45 Machinedramon +Sy
- fputs($socket,"USER VirusType Digimon DigitalMonsters DarkMaster\n");
- fputs($socket,"NICK $name\n");
- sleep(1);
- fwrite($socket,"privmsg nickserv :identify $pass\n");
- sleep(1);
- fwrite($socket,"privmsg hostserv :on\n");
- sleep(1);
- fwrite($socket, "JOIN $join\n");
- sleep(1);
- msg("$join","Prepare to die!\n");
- while(1)
- {
- while ($data = fgets($socket, 254))
- {
- flush();
- $ex = explode(' ', $data);
- // Send PONG back to the server
- if($ex[0] == "PING"){
- fputs($socket, "PONG :".$ex[1]."\n");
- }
- $user = explode('!', $ex[0]);
- $user = $user[0];
- $user = str_replace(":", "", $user);
- #echo nl2br($data);
- echo $data;
- #echo $ex[2].'> '.$ex[0].'> '.exall(3);
- if (isset($ex[2])) { $IRCChannel = $ex[2]; }
- if (isset($ex[3])) { $command = str_replace(array(chr(10), chr(13)), '', $ex[3]); }
- if (isset($ex[4])) { $command2 = str_replace(array(chr(10), chr(13)), '', $ex[4]); }
- null;
- #:irc.codealife.com 353 Machinedramon = #1 :@rapacity ~Alias +Brenden +XTV-Info %
- #Andrew[Away] %Google +Sneaky +_ashLeyrhodeS_ &Rose +Neo|Desktop +Brenden|iPod +L
- #iquid- +Sbot +tiger45 Machinedramon +Sy
- if (($ex[0] == ":$server") && ($ex[1] == 353) && ($ex[2] == "$name"))
- {
- nick(5,$ex[4]);
- }
- ##########
- #
- # Command listings.
- #
- if ((strcasecmp($command,":die") == 0) && ($ex[0] == $master))
- {
- msg($IRCChannel,"yes Sir, right away Sir!");
- fputs($socket,"QUIT :This good Sir?\n");
- die();
- }
- # :?VERSION?
- if (strcasecmp($command,":".$prefix."act") == 0)
- {
- act($IRCChannel,exall(4));
- }
- if (strcasecmp($command,":".$prefix."say") == 0)
- {
- msg($IRCChannel,exall(4));
- }
- if (strcasecmp($command,":".$prefix."info") == 0)
- {
- msg($IRCChannel,"I have these commands: act say var quote");
- msg($IRCChannel,"My command prefix is: '$prefix'");
- }
- if (strcasecmp($command,":".$prefix."var") == 0)
- {
- if (isset($ex[4])) { $varcommand = exall(4); }
- msg($IRCChannel,"var is now ".$varcommand);
- }
- if ((strcasecmp($command,":".$prefix."join") == 0) && ($ex[0] == $master))
- {
- fputs($socket,"JOIN $command2\n");
- }
- if ((strcasecmp($command,":".$prefix."part") == 0) && ($ex[0] == $master))
- {
- fputs($socket,"PART $command2\n");
- }
- if ((strcasecmp($command,":".$prefix."notice") == 0) && ($ex[0] == $master))
- {
- msg($IRCChannel,exall(4));
- }
- if ((strcasecmp($command,":".$prefix."nick") == 0) && ($ex[0] == $master))
- {
- fputs($socket,"nick ".$command2." \n");
- sleep(1);
- fwrite($socket,"privmsg nickserv :identify $pass\n");
- }
- if (strcasecmp($command,":".$prefix."quote") == 0)
- {
- $quoteNumber = (int) rand(0, count($Quote));
- $selectedQuote = $Quote[$quoteNumber];
- msg($IRCChannel,$selectedQuote);
- }
- #(preg_match("/:\001VERSION\001/i",$command))
- if (strcasecmp($command,":\001VERSION\001") == 0)
- {
- ctcp($user,"\001VERSION Machinedra $version (php)\001");
- }
- if (preg_match("/:\001TIME\001/i",$command))
- {
- ctcp($user,"\001TIME ".date("l F d H:i:s Y")."\001");
- }
- # mktime()
- if (preg_match("/:\001PING/i",$command))
- {
- ctcp($user,"\001PING ".mktime()."\001"); # make the mktime $command2 later! ok?
- }
- if (preg_match("/:rawr/i",$command))
- {
- msg($IRCChannel,$command);
- }
- NULL;
- if (strcasecmp($command,":".$prefix."nicks") == 0)
- {
- if (isset($ex[4]))
- {
- if (in_array($ex[4],$nicks))
- {
- msg($IRCChannel,'Yes');
- }
- else
- {
- msg($IRCChannel,'no');
- }
- }
- else
- {
- msg($IRCChannel,'who?');
- }
- }
- #####
- #
- # Truth or dare scriptlets.
- #
- if (strcasecmp($command,":".$prefix."td") == 0)
- {
- if (isset($truth[$IRCChannel]['Status']))
- {
- if ($truth[$IRCChannel]['Status'] == 0)
- {
- $truth[$IRCChannel]['Status'] = 1;
- msg($IRCChannel,"Truth or dare is now on.");
- }
- else
- {
- msg ($IRCChannel,'There is already a game of Truth or Dare for this channel.');
- }
- }
- else
- {
- $truth[$IRCChannel]['Status'] = 1;
- msg($IRCChannel,"Truth or dare is now on.");
- }
- }
- if (strcasecmp($command,":".$prefix."td-") == 0)
- {
- if (isset($truth[$IRCChannel]['Status']))
- {
- if ($truth[$IRCChannel]['Status'] == 1)
- {
- $truth[$IRCChannel]['Status'] = 0;
- msg($IRCChannel,"Truth or dare is now off.");
- }
- else
- {
- msg ($IRCChannel,'There is no longer a game of Truth or Dare for this channel.');
- }
- }
- else
- {
- $truth[$IRCChannel]['Status'] = 0;
- msg($IRCChannel,"Truth or dare is now off.");
- }
- }
- }
- sleep(2);
- }
- ##########
- #
- # Functions.
- #
- function ctcp($user,$ctcp)
- {
- global $socket;
- fputs($socket,"notice $user :".$ctcp."\n");
- }
- function msg($channel,$message)
- {
- global $socket;
- fputs($socket,"privmsg " . $channel . " :" . $message . " \n");
- }
- function not ($channel,$message)
- {
- global $socket;
- fputs($socket,"notice " . $channel . " :" . $message . " \n");
- }
- function act($channel,$message)
- {
- global $socket;
- fputs($socket,"privmsg " . $channel . " :\001ACTION " . $message . " \n");
- }
- # :?ACTION
- function fixStr($string, $min='', $max='')
- {
- $string = preg_replace("/[^a-zA-Z0-9_ -]/", "", $string);
- return $string;
- }
- function exall ($a)
- {
- global $ex;
- $return = '';
- while (isset($ex[$a]))
- {
- $return .= ' '.$ex[$a];
- ++$a;
- }
- return $return;
- }
- function nick ($a,$b)
- {
- global $ex; global $nicks;
- $count = 1;
- while (isset($ex[$a]))
- {
- $nicks[$count] = str_replace(array("~","@","&","+","%",":"), "", $ex[$a]);
- ++$a; ++$count;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement