Example #1
0
 /**
  * @param BotInterface              $bot
  * @param MatcherInterface|callable $matcher  If callable, it should accept a CommandInterface and return a boolean.
  * @param int                       $priority
  *
  * @return self
  */
 public function attach(BotInterface $bot, $matcher = null, $priority = 0)
 {
     if (!$matcher && $bot instanceof MatcherAggregate) {
         $matcher = $bot->getMatcher();
     } else {
         $matcher = function () {
             return true;
         };
     }
     $this->cpu->addListener(Events::RECEIVED_COMMAND, $this->getListener($bot, $matcher), $priority);
     return $this;
 }