replace deprecated functions

This commit is contained in:
sunxyw
2022-03-21 20:49:09 +08:00
parent 680e6a8c5f
commit bc7d5871e4
3 changed files with 11 additions and 11 deletions

View File

@@ -216,8 +216,8 @@ class Context implements ContextInterface
* @param string $prompt * @param string $prompt
* @param int $timeout * @param int $timeout
* @param string $timeout_prompt * @param string $timeout_prompt
* @throws InvalidArgumentException
* @throws WaitTimeoutException * @throws WaitTimeoutException
* @throws InvalidArgumentException
* @return string * @return string
* @noinspection PhpMissingReturnTypeInspection * @noinspection PhpMissingReturnTypeInspection
*/ */
@@ -233,7 +233,7 @@ class Context implements ContextInterface
} }
try { 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) { } catch (Exception $e) {
$r = false; $r = false;
} }
@@ -249,8 +249,8 @@ class Context implements ContextInterface
/** /**
* @param $mode * @param $mode
* @param $prompt_msg * @param $prompt_msg
* @throws InvalidArgumentException
* @throws WaitTimeoutException * @throws WaitTimeoutException
* @throws InvalidArgumentException
* @return mixed|string * @return mixed|string
*/ */
public function getArgs($mode, $prompt_msg) public function getArgs($mode, $prompt_msg)
@@ -276,15 +276,15 @@ class Context implements ContextInterface
ctx()->setCache('match', $arg); ctx()->setCache('match', $arg);
return $a; return $a;
} }
return $this->waitMessage($prompt_msg); return $this->waitMessage($prompt_msg);
} }
throw new InvalidArgumentException(); throw new InvalidArgumentException();
} }
/** /**
* @param string $prompt_msg * @param string $prompt_msg
* @throws InvalidArgumentException
* @throws WaitTimeoutException * @throws WaitTimeoutException
* @throws InvalidArgumentException
* @return int|mixed|string * @return int|mixed|string
*/ */
public function getNextArg($prompt_msg = '') public function getNextArg($prompt_msg = '')
@@ -294,8 +294,8 @@ class Context implements ContextInterface
/** /**
* @param string $prompt_msg * @param string $prompt_msg
* @throws InvalidArgumentException
* @throws WaitTimeoutException * @throws WaitTimeoutException
* @throws InvalidArgumentException
* @return int|mixed|string * @return int|mixed|string
*/ */
public function getFullArg($prompt_msg = '') public function getFullArg($prompt_msg = '')
@@ -305,8 +305,8 @@ class Context implements ContextInterface
/** /**
* @param string $prompt_msg * @param string $prompt_msg
* @throws InvalidArgumentException
* @throws WaitTimeoutException * @throws WaitTimeoutException
* @throws InvalidArgumentException
* @return int|mixed|string * @return int|mixed|string
*/ */
public function getNumArg($prompt_msg = '') public function getNumArg($prompt_msg = '')

View File

@@ -83,9 +83,9 @@ class EventManager
} }
$conf = ZMConfig::get('global', 'worker_cache') ?? ['worker' => 0]; $conf = ZMConfig::get('global', 'worker_cache') ?? ['worker' => 0];
if (server()->worker_id == $conf['worker']) { 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(); LightCache::savePersistence();
}); }, ZMConfig::get('global', 'light_cache')['auto_save_interval'] * 1000);
} }
} }
} }

View File

@@ -99,7 +99,7 @@ class MessageUtil
*/ */
public static function splitCommand($msg): array public static function splitCommand($msg): array
{ {
$word = explodeMsg(str_replace("\r", '', $msg)); $word = explode_msg(str_replace("\r", '', $msg));
if (empty($word)) { if (empty($word)) {
$word = ['']; $word = [''];
} }
@@ -160,7 +160,7 @@ class MessageUtil
break; break;
} }
if ($v->pattern != '') { if ($v->pattern != '') {
$match = matchArgs($v->pattern, $msg); $match = match_args($v->pattern, $msg);
if ($match !== false) { if ($match !== false) {
$matched->match = $match; $matched->match = $match;
$matched->object = $v; $matched->object = $v;