diff --git a/pkg/plugin/host.py b/pkg/plugin/host.py index d4bdeff1..07262f08 100644 --- a/pkg/plugin/host.py +++ b/pkg/plugin/host.py @@ -193,6 +193,7 @@ class PluginHost: try: kwargs['host'] = context.get_plugin_host() kwargs['event'] = event_context + hook(plugin['instance'], **kwargs) if event_context.is_prevented_default(): diff --git a/pkg/plugin/models.py b/pkg/plugin/models.py index 52432f6c..da99bdcc 100644 --- a/pkg/plugin/models.py +++ b/pkg/plugin/models.py @@ -33,6 +33,7 @@ PersonNormalMessageReceived = "person_normal_message_received" returns (optional): alter: str 修改后的消息文本 + reply: list 回复消息组件列表 """ PersonCommandSent = "person_command_sent" @@ -61,6 +62,7 @@ GroupNormalMessageReceived = "group_normal_message_received" returns (optional): alter: str 修改后的消息文本 + reply: list 回复消息组件列表 """ GroupCommandSent = "group_command_sent" diff --git a/pkg/qqbot/process.py b/pkg/qqbot/process.py index 97970473..42f8faed 100644 --- a/pkg/qqbot/process.py +++ b/pkg/qqbot/process.py @@ -106,6 +106,10 @@ def process_message(launcher_type: str, launcher_id: int, text_message: str, mes if event.get_return_value("alter") is not None: text_message = event.get_return_value("alter") + # 取出插件提交的返回值赋值给reply + if event.get_return_value("reply") is not None: + reply = event.get_return_value("reply") + if not event.is_prevented_default(): reply = pkg.qqbot.message.process_normal_message(text_message, mgr, config, launcher_type, launcher_id, sender_id)