mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-21 23:55:35 +08:00
update to 2.0.0-b5 version
set modules config to array add subdir index.html update Example of Hello.php add Exception tester for TimerMiddleware.php add keyword for @CQCommand rename OnWorkerStart.php to OnStart.php remove SwooleEventAfter.php rename HandleEvent.php to SwooleHandler.php set ZMRobot callback mode default to true add getNextArg() and getFullArg() add EventDispatcher.php logger set Exception all based from ZMException fix recursive bug for Response.php add single_bot_mode add SingletonTrait.php add bot() function
This commit is contained in:
@@ -149,7 +149,7 @@ class Context implements ContextInterface
|
||||
} catch (Exception $e) {
|
||||
$r = false;
|
||||
}
|
||||
if($r === false) {
|
||||
if ($r === false) {
|
||||
throw new WaitTimeoutException($this, $timeout_prompt);
|
||||
}
|
||||
return $r["message"];
|
||||
@@ -203,7 +203,6 @@ class Context implements ContextInterface
|
||||
switch ($mode) {
|
||||
case ZM_MATCH_ALL:
|
||||
$p = $arg;
|
||||
array_shift($p);
|
||||
return trim(implode(" ", $p)) == "" ? $this->waitMessage($prompt_msg) : trim(implode(" ", $p));
|
||||
case ZM_MATCH_NUMBER:
|
||||
foreach ($arg as $k => $v) {
|
||||
@@ -215,9 +214,9 @@ class Context implements ContextInterface
|
||||
}
|
||||
return $this->waitMessage($prompt_msg);
|
||||
case ZM_MATCH_FIRST:
|
||||
if (isset($arg[1])) {
|
||||
$a = $arg[1];
|
||||
array_splice($arg, 1, 1);
|
||||
if (isset($arg[0])) {
|
||||
$a = $arg[0];
|
||||
array_splice($arg, 0, 1);
|
||||
ctx()->setCache("match", $arg);
|
||||
return $a;
|
||||
} else {
|
||||
@@ -227,6 +226,22 @@ class Context implements ContextInterface
|
||||
throw new InvalidArgumentException();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prompt_msg
|
||||
* @return int|mixed|string
|
||||
* @throws InvalidArgumentException
|
||||
* @throws WaitTimeoutException
|
||||
*/
|
||||
public function getNextArg($prompt_msg = "") { return $this->getArgs(ZM_MATCH_FIRST, $prompt_msg); }
|
||||
|
||||
/**
|
||||
* @param string $prompt_msg
|
||||
* @return int|mixed|string
|
||||
* @throws InvalidArgumentException
|
||||
* @throws WaitTimeoutException
|
||||
*/
|
||||
public function getFullArg($prompt_msg = "") { return $this->getArgs(ZM_MATCH_ALL, $prompt_msg); }
|
||||
|
||||
public function cloneFromParent() {
|
||||
set_coroutine_params(self::$context[Co::getPcid()] ?? self::$context[$this->cid]);
|
||||
return context();
|
||||
|
||||
Reference in New Issue
Block a user