- hexi core: message handling, rate limiting, cooldown, plugin manager - Custom plugins: BF stats, daily check-in, quotes, persona cards, etc. - Community plugins vendored under hexi/plugins with local fixes - Web admin frontends (learning-chat, persona-admin), unified hexi/web - Tests for rate_limit/cooldown/memes/persona; poetry.lock Co-Authored-By: Claude <noreply@anthropic.com>
21 lines
624 B
Python
21 lines
624 B
Python
"""业务逻辑层:一个业务动作一个方法;不依赖 nonebot(可单测)。"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from hexi.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
|