replace deprecated functions

This commit is contained in:
sunxyw 2022-03-21 20:49:09 +08:00
parent 680e6a8c5f
commit bc7d5871e4
No known key found for this signature in database
GPG Key ID: CEA01A083E98C578
3 changed files with 11 additions and 11 deletions

View File

@ -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 = '')

View File

@ -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);
}
}
}

View File

@ -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;