mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-03-18 05:04:51 +08:00
add prompt update event option
This commit is contained in:
parent
2d9f51547d
commit
00da7d14fb
@ -45,6 +45,7 @@ const ZM_PROMPT_TIMEOUT_QUOTE_USER = 16; // 回复超时时引用用户
|
||||
const ZM_PROMPT_RETURN_STRING = 32; // 回复返回 string 格式
|
||||
const ZM_PROMPT_RETURN_ARRAY = 0; // 回复返回消息段格式
|
||||
const ZM_PROMPT_RETURN_EVENT = 64; // 回复返回 prompt 消息所对应的事件对象格式
|
||||
const ZM_PROMPT_UPDATE_EVENT = 128; // 在接收到 prompt 后,更新容器内绑定的事件对象
|
||||
|
||||
const ZM_PLUGIN_TYPE_NATIVE = 0; // 原生类型的插件,特指内部插件、ZMApplication 继承的插件
|
||||
const ZM_PLUGIN_TYPE_PHAR = 1; // Phar 类型的插件
|
||||
|
||||
@ -273,6 +273,11 @@ class BotContext implements ContextInterface
|
||||
if (!$result instanceof OneBotEvent || $result->type !== 'message') {
|
||||
throw new OneBot12Exception('Internal error for resuming prompt: unknown type ' . gettype($result));
|
||||
}
|
||||
// 更新容器内的事件绑定对象
|
||||
if (($option & ZM_PROMPT_UPDATE_EVENT) === ZM_PROMPT_UPDATE_EVENT) {
|
||||
container()->set(OneBotEvent::class, $result);
|
||||
container()->set('bot.event', $result);
|
||||
}
|
||||
// 是否为 string 回复
|
||||
if (($option & ZM_PROMPT_RETURN_STRING) === ZM_PROMPT_RETURN_STRING) {
|
||||
return $result->getMessageString();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user