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,22 @@
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
from nonebot_plugin_alconna import UniMessage
|
||||
|
||||
|
||||
def local_video(path: str) -> UniMessage:
|
||||
"""构造本地视频消息(覆盖 Media.__post_init__ 的 https 前缀规范化)"""
|
||||
msg = UniMessage.video(url=path)
|
||||
msg[0].url = path
|
||||
return msg
|
||||
|
||||
|
||||
def get_video_info(url: str) -> str:
|
||||
res = subprocess.run(["you-get", "-i", url], capture_output=True, text=True)
|
||||
return res.stdout
|
||||
|
||||
|
||||
def download_video(url: str, filepath: Path, filename: str) -> None:
|
||||
subprocess.run(
|
||||
["you-get", "-o", str(filepath), "-O", filename, url], capture_output=True
|
||||
)
|
||||
Reference in New Issue
Block a user