Files
HeXi/plugin_template/nonebot_plugin_template/services/main.py
T
sansenhoshiandClaude b61d09f09f Add HeXi bot codebase: custom plugins, web frontends, tests
- 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>
2026-09-01 13:13:40 +08:00

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