diff --git a/src/ZM/Context/Context.php b/src/ZM/Context/Context.php index 248e15ec..a1f54638 100644 --- a/src/ZM/Context/Context.php +++ b/src/ZM/Context/Context.php @@ -216,8 +216,8 @@ class Context implements ContextInterface * @param string $prompt * @param int $timeout * @param string $timeout_prompt - * @throws InvalidArgumentException * @throws WaitTimeoutException + * @throws InvalidArgumentException * @return string * @noinspection PhpMissingReturnTypeInspection */ @@ -233,7 +233,7 @@ class Context implements ContextInterface } try { - $r = CoMessage::yieldByWS($this->getData(), ['user_id', 'self_id', 'message_type', onebot_target_id_name($this->getMessageType())], $timeout); + $r = CoMessage::yieldByWS($this->getData(), ['user_id', 'self_id', 'message_type', get_onebot_target_id_name($this->getMessageType())], $timeout); } catch (Exception $e) { $r = false; } @@ -249,8 +249,8 @@ class Context implements ContextInterface /** * @param $mode * @param $prompt_msg - * @throws InvalidArgumentException * @throws WaitTimeoutException + * @throws InvalidArgumentException * @return mixed|string */ public function getArgs($mode, $prompt_msg) @@ -276,15 +276,15 @@ class Context implements ContextInterface ctx()->setCache('match', $arg); return $a; } - return $this->waitMessage($prompt_msg); + return $this->waitMessage($prompt_msg); } throw new InvalidArgumentException(); } /** * @param string $prompt_msg - * @throws InvalidArgumentException * @throws WaitTimeoutException + * @throws InvalidArgumentException * @return int|mixed|string */ public function getNextArg($prompt_msg = '') @@ -294,8 +294,8 @@ class Context implements ContextInterface /** * @param string $prompt_msg - * @throws InvalidArgumentException * @throws WaitTimeoutException + * @throws InvalidArgumentException * @return int|mixed|string */ public function getFullArg($prompt_msg = '') @@ -305,8 +305,8 @@ class Context implements ContextInterface /** * @param string $prompt_msg - * @throws InvalidArgumentException * @throws WaitTimeoutException + * @throws InvalidArgumentException * @return int|mixed|string */ public function getNumArg($prompt_msg = '') diff --git a/src/ZM/Event/EventManager.php b/src/ZM/Event/EventManager.php index b48d5008..a93f0ae5 100644 --- a/src/ZM/Event/EventManager.php +++ b/src/ZM/Event/EventManager.php @@ -83,9 +83,9 @@ class EventManager } $conf = ZMConfig::get('global', 'worker_cache') ?? ['worker' => 0]; if (server()->worker_id == $conf['worker']) { - zm_timer_tick(ZMConfig::get('global', 'light_cache')['auto_save_interval'] * 1000, function () { + run_repeating(static function () { LightCache::savePersistence(); - }); + }, ZMConfig::get('global', 'light_cache')['auto_save_interval'] * 1000); } } } diff --git a/src/ZM/Utils/MessageUtil.php b/src/ZM/Utils/MessageUtil.php index 0acdf8fe..652f09bc 100644 --- a/src/ZM/Utils/MessageUtil.php +++ b/src/ZM/Utils/MessageUtil.php @@ -99,7 +99,7 @@ class MessageUtil */ public static function splitCommand($msg): array { - $word = explodeMsg(str_replace("\r", '', $msg)); + $word = explode_msg(str_replace("\r", '', $msg)); if (empty($word)) { $word = ['']; } @@ -160,7 +160,7 @@ class MessageUtil break; } if ($v->pattern != '') { - $match = matchArgs($v->pattern, $msg); + $match = match_args($v->pattern, $msg); if ($match !== false) { $matched->match = $match; $matched->object = $v;