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>
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
"""handlers 包:触发器(Trigger)层。"""
|
||||
|
||||
from .entry import cmd # noqa: F401
|
||||
@@ -0,0 +1,29 @@
|
||||
"""触发器(Trigger)层:接触发 → 鉴权 → 调 service → 出 View。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from nonebot import on_command
|
||||
from nonebot.adapters import Message
|
||||
from nonebot.rule import to_me
|
||||
from nonebot.params import CommandArg
|
||||
from nonebot_plugin_alconna import UniMessage
|
||||
|
||||
from hexi.web_config import get_effective_value
|
||||
|
||||
from ..services.main import do_something
|
||||
|
||||
_PLUGIN_ID = __package__.rsplit(".", 1)[0]
|
||||
|
||||
cmd = on_command("模板指令", aliases={"模板"}, rule=to_me(), priority=10, block=True)
|
||||
|
||||
|
||||
@cmd.handle()
|
||||
async def handle(arg: Message = CommandArg()):
|
||||
if not get_effective_value(_PLUGIN_ID, "enable", True):
|
||||
await cmd.finish("模板插件已停用")
|
||||
return
|
||||
text = arg.extract_plain_text().strip()
|
||||
if not text:
|
||||
await cmd.finish("请提供要记录的内容")
|
||||
result = await do_something(text)
|
||||
await UniMessage.text(result).send()
|
||||
Reference in New Issue
Block a user