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:
2026-09-01 13:13:40 +08:00
co-authored by Claude
parent 1783c60afa
commit b61d09f09f
3201 changed files with 160436 additions and 171 deletions
@@ -0,0 +1,47 @@
from datetime import datetime
from nonebot import require
require("nonebot_plugin_orm")
from nonebot_plugin_orm import Model, get_session
from sqlalchemy import BigInteger, Date, Integer, select
from sqlalchemy.orm import Mapped, mapped_column
class CheckInRecord(Model):
"""打卡记录,一行一次打卡,同一天可多次"""
__tablename__ = "deer_pipe_checkin"
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
uid: Mapped[int] = mapped_column(BigInteger, index=True)
date: Mapped[datetime.date] = mapped_column(Date, index=True)
# 记录信息
async def record_month(uid):
now = datetime.now()
async with get_session() as session:
session.add(CheckInRecord(uid=int(uid), date=now.date()))
await session.commit()
# 读取当月信息(返回当月所有打卡的日,同一天多次打卡会有重复项)
async def get_records(uid):
now = datetime.now()
month_start = datetime(now.year, now.month, 1).date()
if now.month == 12:
month_end = datetime(now.year + 1, 1, 1).date()
else:
month_end = datetime(now.year, now.month + 1, 1).date()
async with get_session() as session:
result = await session.execute(
select(CheckInRecord.date).where(
CheckInRecord.uid == int(uid),
CheckInRecord.date >= month_start,
CheckInRecord.date < month_end,
)
)
days = result.all()
return [row[0].day for row in days]