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,33 @@
import re
def convert_to_hours(time_str):
"""
将各种时间格式字符串转换为小时数
支持格式示例:
- "1 day, 1:49:15" (包含天数)
- "1:56:55" (小时:分钟:秒)
- "0:06:41" (分钟:秒)
- "14:11:36" (小时:分钟:秒)
"""
total_hours = 0.0
# 处理包含天数的部分
if "day" in time_str:
days_part, time_part = time_str.split(", ")
days = float(re.search(r"\d+", days_part).group())
total_hours += days * 24
time_str = time_part
# 分割时间部分
parts = list(map(float, time_str.split(":")))
# 根据时间部分长度计算
if len(parts) == 3: # 时:分:秒
total_hours += parts[0] + parts[1] / 60 + parts[2] / 3600
elif len(parts) == 2: # 分:秒
total_hours += parts[0] / 60 + parts[1] / 3600
elif len(parts) == 1: # 仅秒
total_hours += parts[0] / 3600
return round(total_hours, 2)