21 lines
632 B
Python
21 lines
632 B
Python
"""业务逻辑层:一个业务动作一个方法;不依赖 nonebot(可单测)。"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from hexi.web_hub.web_config import get_effective_value
|
|
|
|
from ..repository import get_record, save_record
|
|
|
|
_PLUGIN_ID = __package__.rsplit(".", 1)[0]
|
|
|
|
|
|
async def do_something(text: str) -> str:
|
|
"""示例业务:记录输入并返回带配置的回复。"""
|
|
save_record("last_input", text)
|
|
|
|
prefix = get_effective_value(_PLUGIN_ID, "reply", "你好,我是模板插件!")
|
|
record = get_record("last_input")
|
|
if record:
|
|
return f"{prefix} 已记录:{record}"
|
|
return prefix
|