예제 #1
0
 /**
  * Respond to PING messages
  * @param IRCMessageInboundEvent $e The last data received.
  */
 public function pingListener($e)
 {
     if ($e->getMessage()->getCommand() != 'PING') {
         return;
     }
     $this->bot->sendData('PONG ' . substr($e->getMessage()->getMessage(), 5));
     $this->lastActivity = time();
 }
예제 #2
0
 /**
  * This function watches for channel joins and parts, and keeps track of them.
  * @param IRCMessageInboundEvent $e
  */
 public function gateWatcher($e)
 {
     if (!empty($e->getMessage()->get()['code']) && $e->getMessage()->getCode() == 'RPL_TOPIC') {
         $channel = $e->getMessage()->getParams()[1];
         $this->bot->log('Joined channel {channel}', array('channel' => $channel), LogLevels::CHANNEL);
         $this->addChannel($channel);
         $this->evman()->getEvent('ChannelJoin')->trigger(new ChannelJoinEvent($channel));
     }
     if (($e->getMessage()->getCommand() == 'KICK' || $e->getMessage()->getCommand() == 'PART') && $e->getMessage()->getNickname() == $this->bot->getNickname()) {
         $channel = $e->getMessage()->getParams()['channel'];
         $this->bot->log('Left channel {channel}', array('channel' => $channel), LogLevels::CHANNEL);
         $this->removeChannel($channel);
         $this->evman()->getEvent('ChannelPart')->trigger(new ChannelPartEvent($channel));
     }
 }