mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-23 02:27:14 +00:00
feat: 将事件名称统一为 名词+动词 形式
This commit is contained in:
@@ -153,7 +153,7 @@ class Session:
|
|||||||
'default_prompt': self.prompt,
|
'default_prompt': self.prompt,
|
||||||
}
|
}
|
||||||
|
|
||||||
event = pkg.plugin.host.emit(plugin_models.SessionFirstMessage, **args)
|
event = pkg.plugin.host.emit(plugin_models.SessionFirstMessageReceived, **args)
|
||||||
if event.is_prevented_default():
|
if event.is_prevented_default():
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import pkg.utils.context
|
|||||||
|
|
||||||
__current_registering_plugin__ = ""
|
__current_registering_plugin__ = ""
|
||||||
|
|
||||||
PersonMessage = "person_message"
|
PersonMessageReceived = "person_message_received"
|
||||||
"""收到私聊消息时,在判断是否应该响应前触发
|
"""收到私聊消息时,在判断是否应该响应前触发
|
||||||
kwargs:
|
kwargs:
|
||||||
launcher_type: str 发起对象类型(group/person)
|
launcher_type: str 发起对象类型(group/person)
|
||||||
@@ -14,7 +14,7 @@ PersonMessage = "person_message"
|
|||||||
message_chain: mirai.models.message.MessageChain 消息链
|
message_chain: mirai.models.message.MessageChain 消息链
|
||||||
"""
|
"""
|
||||||
|
|
||||||
GroupMessage = "group_message"
|
GroupMessageReceived = "group_message_received"
|
||||||
"""收到群聊消息时,在判断是否应该响应前触发(所有群消息)
|
"""收到群聊消息时,在判断是否应该响应前触发(所有群消息)
|
||||||
kwargs:
|
kwargs:
|
||||||
launcher_type: str 发起对象类型(group/person)
|
launcher_type: str 发起对象类型(group/person)
|
||||||
@@ -23,7 +23,7 @@ GroupMessage = "group_message"
|
|||||||
message_chain: mirai.models.message.MessageChain 消息链
|
message_chain: mirai.models.message.MessageChain 消息链
|
||||||
"""
|
"""
|
||||||
|
|
||||||
PersonNormalMessage = "person_normal_message"
|
PersonNormalMessageReceived = "person_normal_message_received"
|
||||||
"""判断为应该处理的私聊普通消息时触发
|
"""判断为应该处理的私聊普通消息时触发
|
||||||
kwargs:
|
kwargs:
|
||||||
launcher_type: str 发起对象类型(group/person)
|
launcher_type: str 发起对象类型(group/person)
|
||||||
@@ -32,7 +32,7 @@ PersonNormalMessage = "person_normal_message"
|
|||||||
text_message: str 消息文本
|
text_message: str 消息文本
|
||||||
"""
|
"""
|
||||||
|
|
||||||
PersonCommand = "person_command"
|
PersonCommandSent = "person_command_sent"
|
||||||
"""判断为应该处理的私聊指令时触发
|
"""判断为应该处理的私聊指令时触发
|
||||||
kwargs:
|
kwargs:
|
||||||
launcher_type: str 发起对象类型(group/person)
|
launcher_type: str 发起对象类型(group/person)
|
||||||
@@ -44,7 +44,7 @@ PersonCommand = "person_command"
|
|||||||
is_admin: bool 是否为管理员
|
is_admin: bool 是否为管理员
|
||||||
"""
|
"""
|
||||||
|
|
||||||
GroupNormalMessage = "group_normal_message"
|
GroupNormalMessageReceived = "group_normal_message_received"
|
||||||
"""判断为应该处理的群聊普通消息时触发
|
"""判断为应该处理的群聊普通消息时触发
|
||||||
kwargs:
|
kwargs:
|
||||||
launcher_type: str 发起对象类型(group/person)
|
launcher_type: str 发起对象类型(group/person)
|
||||||
@@ -53,7 +53,7 @@ GroupNormalMessage = "group_normal_message"
|
|||||||
text_message: str 消息文本
|
text_message: str 消息文本
|
||||||
"""
|
"""
|
||||||
|
|
||||||
GroupCommand = "group_command"
|
GroupCommandSent = "group_command_sent"
|
||||||
"""判断为应该处理的群聊指令时触发
|
"""判断为应该处理的群聊指令时触发
|
||||||
kwargs:
|
kwargs:
|
||||||
launcher_type: str 发起对象类型(group/person)
|
launcher_type: str 发起对象类型(group/person)
|
||||||
@@ -65,7 +65,7 @@ GroupCommand = "group_command"
|
|||||||
is_admin: bool 是否为管理员
|
is_admin: bool 是否为管理员
|
||||||
"""
|
"""
|
||||||
|
|
||||||
SessionFirstMessage = "session_first_message"
|
SessionFirstMessageReceived = "session_first_message_received"
|
||||||
"""会话被第一次交互时触发
|
"""会话被第一次交互时触发
|
||||||
kwargs:
|
kwargs:
|
||||||
session_name: str 会话名称(<launcher_type>_<launcher_id>)
|
session_name: str 会话名称(<launcher_type>_<launcher_id>)
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ class QQBotManager:
|
|||||||
"sender_id": event.sender.id,
|
"sender_id": event.sender.id,
|
||||||
"message_chain": event.message_chain,
|
"message_chain": event.message_chain,
|
||||||
}
|
}
|
||||||
plugin_event = plugin_host.emit(plugin_models.PersonMessage, **args)
|
plugin_event = plugin_host.emit(plugin_models.PersonMessageReceived, **args)
|
||||||
|
|
||||||
if plugin_event.is_prevented_default():
|
if plugin_event.is_prevented_default():
|
||||||
return
|
return
|
||||||
@@ -121,7 +121,7 @@ class QQBotManager:
|
|||||||
"sender_id": event.sender.id,
|
"sender_id": event.sender.id,
|
||||||
"message_chain": event.message_chain,
|
"message_chain": event.message_chain,
|
||||||
}
|
}
|
||||||
plugin_event = plugin_host.emit(plugin_models.PersonMessage, **args)
|
plugin_event = plugin_host.emit(plugin_models.PersonMessageReceived, **args)
|
||||||
|
|
||||||
if plugin_event.is_prevented_default():
|
if plugin_event.is_prevented_default():
|
||||||
return
|
return
|
||||||
@@ -137,7 +137,7 @@ class QQBotManager:
|
|||||||
"sender_id": event.sender.id,
|
"sender_id": event.sender.id,
|
||||||
"message_chain": event.message_chain,
|
"message_chain": event.message_chain,
|
||||||
}
|
}
|
||||||
plugin_event = plugin_host.emit(plugin_models.GroupMessage, **args)
|
plugin_event = plugin_host.emit(plugin_models.GroupMessageReceived, **args)
|
||||||
|
|
||||||
if plugin_event.is_prevented_default():
|
if plugin_event.is_prevented_default():
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -77,9 +77,9 @@ def process_message(launcher_type: str, launcher_id: int, text_message: str, mes
|
|||||||
'text_message': text_message,
|
'text_message': text_message,
|
||||||
'is_admin': sender_id is config.admin_qq,
|
'is_admin': sender_id is config.admin_qq,
|
||||||
}
|
}
|
||||||
event = plugin_host.emit(plugin_models.PersonCommand
|
event = plugin_host.emit(plugin_models.PersonCommandSent
|
||||||
if launcher_type == 'person'
|
if launcher_type == 'person'
|
||||||
else plugin_models.GroupCommand, **args)
|
else plugin_models.GroupCommandSent, **args)
|
||||||
|
|
||||||
if not event.is_prevented_default():
|
if not event.is_prevented_default():
|
||||||
reply = pkg.qqbot.command.process_command(session_name, text_message,
|
reply = pkg.qqbot.command.process_command(session_name, text_message,
|
||||||
@@ -93,9 +93,9 @@ def process_message(launcher_type: str, launcher_id: int, text_message: str, mes
|
|||||||
"sender_id": sender_id,
|
"sender_id": sender_id,
|
||||||
"text_message": text_message,
|
"text_message": text_message,
|
||||||
}
|
}
|
||||||
event = plugin_host.emit(plugin_models.PersonNormalMessage
|
event = plugin_host.emit(plugin_models.PersonNormalMessageReceived
|
||||||
if launcher_type == 'person'
|
if launcher_type == 'person'
|
||||||
else plugin_models.GroupNormalMessage, **args)
|
else plugin_models.GroupNormalMessageReceived, **args)
|
||||||
|
|
||||||
if not event.is_prevented_default():
|
if not event.is_prevented_default():
|
||||||
reply = pkg.qqbot.message.process_normal_message(text_message,
|
reply = pkg.qqbot.message.process_normal_message(text_message,
|
||||||
|
|||||||
Reference in New Issue
Block a user