30 class PingReply extends \Erebot\Module\Base implements \Erebot\Interfaces\HelpEnabled
46 if ($flags & self::RELOAD_HANDLERS) {
47 $handler = new \Erebot\EventHandler(
48 \
Erebot\CallableWrapper::wrap(array($this,
'handlePing')),
49 new \
Erebot\Event\Match\Type(
'\\Erebot\\Interfaces\\Event\\Ping')
51 $this->connection->addEventHandler($handler);
55 public function getHelp(
56 \
Erebot\Interfaces\Event\Base\TextMessage $event,
57 \
Erebot\Interfaces\TextWrapper $words
59 if ($event instanceof \
Erebot\Interfaces\Event\Base\PrivateMessage) {
60 $target = $event->getSource();
63 $target = $chan = $event->getChan();
66 if (count($words) == 1 && $words[0] === get_called_class()) {
67 $msg = $this->getFormatter($chan)->_(
68 "This module does not provide any command but replies ".
69 "to a server's PING message with the appropriate PONG ".
72 $this->sendMessage($target, $msg);
89 \
Erebot\Interfaces\EventHandler $handler,
90 \
Erebot\Interfaces\Event\Ping $event
92 $this->sendCommand(
'PONG :'.$event->getText());
handlePing(\Erebot\Interfaces\EventHandler $handler,\Erebot\Interfaces\Event\Ping $event)
A basic module that sends replies to PING queries it receives.