public function match(\Erebot\Interfaces\Event\Base\Generic $event) { if (!$event instanceof \Erebot\Interfaces\Event\Base\Chan) { return false; } $collator = $event->getConnection()->getCollator(); return $collator->compare($event->getChan(), (string) $this->chan) == 0; }
public function match(\Erebot\Interfaces\Event\Base\Generic $event) { if (!$event instanceof \Erebot\Interfaces\Event\Base\Source) { return false; } if ($this->source === null) { return true; } $collator = $event->getConnection()->getCollator(); return $collator->compare($event->getSource(), (string) $this->source) == 0; }
public function match(\Erebot\Interfaces\Event\Base\Generic $event) { if (!$event instanceof \Erebot\Interfaces\Event\Base\Text) { return false; } $prefix = $event->getConnection()->getConfig(null)->getMainCfg()->getCommandsPrefix(); $result = $this->realMatch($prefix, $event->getText()); if (!is_bool($result)) { throw new \Erebot\InvalidValueException('Invalid return value'); } return $result; }