Ejemplo n.º 1
0
 /**
  * Run the bot.
  */
 public function run()
 {
     if ($this->connection->isConnected()) {
         trigger_error('Cannot start multiple instances of the bot; it is already connected. Ignoring run request.', E_USER_WARNING);
         return;
     }
     $this->log('The following commands are known by the bot: "' . implode(',', array_keys($this->commandManager->listCommands())) . '".', 'INFO');
     $this->log('The following listeners are known by the bot: "' . implode(',', array_keys($this->listenerManager->listListeners())) . '".', 'INFO');
     $this->connection->connect();
     $this->log('Fueling the main loop...', 'STARTUP');
     $this->main();
 }
Ejemplo n.º 2
0
 /**
  * Connects the bot to the server.
  *
  * @author Super3 <*****@*****.**>
  * @author Daniel Siepmann <*****@*****.**>
  */
 public function connectToServer()
 {
     if (empty($this->nickToUse)) {
         $this->nickToUse = $this->nick;
     }
     if ($this->connection->isConnected()) {
         $this->connection->disconnect();
     }
     $this->log('The following commands are known by the bot: "' . implode(',', array_keys($this->commands)) . '".', 'INFO');
     $this->log('The following listeners are known by the bot: "' . implode(',', array_keys($this->listeners)) . '".', 'INFO');
     $this->connection->connect();
     $this->sendDataToServer('USER ' . $this->nickToUse . ' Layne-Obserdia.de ' . $this->nickToUse . ' :' . $this->name);
     $this->sendDataToServer('NICK ' . $this->nickToUse);
     $this->main();
 }