mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-21 23:55:35 +08:00
fix multiple prompt timer bug
This commit is contained in:
@@ -2,6 +2,20 @@
|
||||
|
||||
> 本页面由框架命令 `./zhamao generate:text update-log-md` 自动生成
|
||||
|
||||
## v3.0.1
|
||||
|
||||
> 更新时间:2023-02-11
|
||||
|
||||
* 本次更新包含文档更新内容 1 个
|
||||
* 修复 Message 转换时的 Bug by [@crazywhalecc](https://github.com/crazywhalecc) in [PR#289](https://github.com/zhamao-robot/zhamao-framework/pull/289)
|
||||
* 修复初始化命令兼容性问题 by [@sunxyw](https://github.com/sunxyw) in [PR#295](https://github.com/zhamao-robot/zhamao-framework/pull/295)
|
||||
* 修复安装脚本不使用内置 Composer by [@sunxyw](https://github.com/sunxyw) in [PR#296](https://github.com/zhamao-robot/zhamao-framework/pull/296)
|
||||
* 修复插件安装命令若干问题 by [@sunxyw](https://github.com/sunxyw) in [PR#297](https://github.com/zhamao-robot/zhamao-framework/pull/297)
|
||||
* 修复排程任务不支持提醒 by [@sunxyw](https://github.com/sunxyw) in [PR#298](https://github.com/zhamao-robot/zhamao-framework/pull/298)
|
||||
* **破坏性修改**:更改 prompt() 方法配置参数的特性 by [@crazywhalecc](https://github.com/crazywhalecc) in [PR#299](https://github.com/zhamao-robot/zhamao-framework/pull/299)
|
||||
|
||||
**源码变更记录**: <https://github.com/zhamao-robot/zhamao-framework/compare/3.0.0...3.0.1>
|
||||
|
||||
## v3.0.0
|
||||
|
||||
> 更新时间:2023-02-10
|
||||
|
||||
@@ -16,6 +16,7 @@ use ZM\Context\Trait\BotActionTrait;
|
||||
use ZM\Exception\OneBot12Exception;
|
||||
use ZM\Exception\WaitTimeoutException;
|
||||
use ZM\Plugin\OneBot12Adapter;
|
||||
use ZM\Schedule\Timer;
|
||||
use ZM\Utils\MessageUtil;
|
||||
|
||||
class BotContext implements ContextInterface
|
||||
@@ -114,14 +115,14 @@ class BotContext implements ContextInterface
|
||||
}
|
||||
$cid = $co->getCid();
|
||||
OneBot12Adapter::addContextPrompt($cid, $event);
|
||||
$co->create(function () use ($cid, $timeout) {
|
||||
Adaptive::sleep($timeout);
|
||||
$timer_id = zm_timer_after($timeout * 1000, function () use ($cid) {
|
||||
if (OneBot12Adapter::isContextPromptExists($cid)) {
|
||||
Adaptive::getCoroutine()->resume($cid, '');
|
||||
}
|
||||
});
|
||||
$result = $co->suspend();
|
||||
OneBot12Adapter::removeContextPrompt($cid);
|
||||
Timer::del($timer_id);
|
||||
if ($result === '') {
|
||||
throw new WaitTimeoutException(
|
||||
$this,
|
||||
|
||||
@@ -47,7 +47,7 @@ class Framework
|
||||
public const VERSION_ID = 689;
|
||||
|
||||
/** @var string 版本名称 */
|
||||
public const VERSION = '3.0.1';
|
||||
public const VERSION = '3.0.2';
|
||||
|
||||
/** @var array 传入的参数 */
|
||||
protected array $argv;
|
||||
|
||||
@@ -19,6 +19,11 @@ class Timer
|
||||
return Framework::getInstance()->getDriver()->getEventLoop()->addTimer($ms, $callback);
|
||||
}
|
||||
|
||||
public static function del(int $timer_id): void
|
||||
{
|
||||
Framework::getInstance()->getDriver()->getEventLoop()->clearTimer($timer_id);
|
||||
}
|
||||
|
||||
public static function registerTick(Tick $v): void
|
||||
{
|
||||
if ($v->class !== '' && $v->method !== '') {
|
||||
|
||||
Reference in New Issue
Block a user