Skip to content

Commit

Permalink
Merge pull request #193 from HanSon/dev
Browse files Browse the repository at this point in the history
增加扩展阻拦
  • Loading branch information
Hanson authored Jul 17, 2017
2 parents 898daaf + 86b1c06 commit 88ab88a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/Core/MessageHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,9 @@ private function handleMessage($selector)
if ($collection) {
$this->cache($msg, $collection);
$this->console($collection);
if ($this->handler) {
if (!$this->vbot->messageExtension->exec($collection) && $this->handler) {
call_user_func_array($this->handler, [$collection]);
}
$this->vbot->messageExtension->exec($collection);
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/Extension/MessageExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,14 @@ private function initBaseExtensions()
* 执行拓展.
*
* @param $collection
*
* @return bool
*/
public function exec($collection)
{
foreach ($this->serviceExtensions as $extension) {
if ($extension->messageHandler($collection)) {
return;
return true;
}
}
}
Expand Down

0 comments on commit 88ab88a

Please sign in to comment.