Advertisement
Guest User

Untitled

a guest
May 28th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.98 KB | None | 0 0
  1. <?php
  2.  
  3.     class Bot extends IRC {
  4.         private $ModuleSystem;
  5.         public function __construct() {
  6.             $this->ModuleSystem = new Module();
  7.         }
  8.         public function Start() {
  9.             $this->Connect(); //Connect that bot, yo...
  10.             $this->Listener(); //Listen to it's shit, yo... lolz.
  11.            
  12.         }
  13.         public function Listener() {
  14.             while (1) { //This will be changed at some point, need to come up with a check system...
  15.                 $Buffer = $this->Read(); // This is reading the raw line from the IRCd. I wouldn't process anything off of this, unless you are really good with REGEX.
  16.                 $BufferBits = explode(" ", $Buffer); // This breaks down the big line of shit into something more easy to base triggers off of...
  17.                 if ($BufferBits[0] == "PING") {
  18.                     $this->Write("PONG ".$BufferBits[1]."\r\n"); // PONG that PING the server sends, makes it so the bot doesn't ping out.
  19.                 }
  20.                 $this->ModuleSystem->GetBuffer($Buffer); //Sends the contents of Buffer to the module system.
  21.             }
  22.         }      
  23.     }
  24.    
  25.  
  26.  
  27.  
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement