mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-10 07:46:02 +00:00
feat: adapt more events
This commit is contained in:
@@ -7,13 +7,14 @@ import traceback
|
||||
from .. import handler
|
||||
from ... import entities
|
||||
from ....provider import runner as runner_module
|
||||
from ....plugin import events
|
||||
|
||||
import langbot_plugin.api.entities.builtin.platform.message as platform_message
|
||||
import langbot_plugin.api.entities.events as events
|
||||
from ....utils import importutil
|
||||
from ....provider import runners
|
||||
import langbot_plugin.api.entities.builtin.provider.session as provider_session
|
||||
import langbot_plugin.api.entities.builtin.pipeline.query as pipeline_query
|
||||
import langbot_plugin.api.entities.context as event_context
|
||||
|
||||
|
||||
importutil.import_modules_in_pkg(runners)
|
||||
@@ -35,7 +36,7 @@ class ChatMessageHandler(handler.MessageHandler):
|
||||
else events.GroupNormalMessageReceived
|
||||
)
|
||||
|
||||
event_ctx = await self.ap.plugin_mgr.emit_event(
|
||||
event_ctx = event_context.EventContext(
|
||||
event=event_class(
|
||||
launcher_type=query.launcher_type.value,
|
||||
launcher_id=query.launcher_id,
|
||||
@@ -45,6 +46,12 @@ class ChatMessageHandler(handler.MessageHandler):
|
||||
)
|
||||
)
|
||||
|
||||
event_ctx_result = await self.ap.plugin_connector.handler.emit_event(
|
||||
event_ctx.model_dump(serialize_as_any=True)
|
||||
)
|
||||
|
||||
event_ctx = event_context.EventContext.parse_from_dict(event_ctx_result['event_context'])
|
||||
|
||||
if event_ctx.is_prevented_default():
|
||||
if event_ctx.event.reply is not None:
|
||||
mc = platform_message.MessageChain(event_ctx.event.reply)
|
||||
|
||||
Reference in New Issue
Block a user