功能:通过 HTTP API 实现 Danding_QqPush 插件,用于 QQ 群通知

- 增加了通过外部 HTTP API 向 QQ 群组发送消息的核心功能。
- 实现了对长文本消息的图片渲染,以避免被认定为垃圾信息。
- 支持在消息中提及特定的 QQ 用户。
- 创建了用于 API 令牌和图片渲染设置的配置选项。
- 开发了一个测试脚本以验证 API 功能。
- 对现有代码进行了重构,以提高组织性和可维护性。
This commit is contained in:
2026-01-20 21:19:05 +08:00
parent 4a944316fe
commit dedc872f1b
14 changed files with 1065 additions and 48 deletions

View File

@@ -0,0 +1,42 @@
"""Danding_QqPush 插件配置模块"""
from pydantic import BaseModel
class Config(BaseModel):
"""插件配置"""
Token: str = "danding-8HkL9xQ2"
"""API 访问 Token用于鉴权"""
# 图片生成配置
ImageWidth: int = 800
"""生成的图片宽度(像素)"""
ImageFontSize: int = 24
"""字体大小(像素)"""
ImagePadding: int = 30
"""图片内边距(像素)"""
ImageLineSpacing: float = 1.4
"""行距倍数"""
ImageBgColor: tuple = (252, 252, 252)
"""图片背景颜色 (R, G, B)"""
ImageTextColor: tuple = (0, 0, 0)
"""文本颜色 (R, G, B)"""
# 文本处理配置
MaxTextLength: int = 2000
"""最大文本长度(字符数),超过将截断"""
# 字体路径配置
FontPaths: list = [
"/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc",
"/usr/share/fonts/wqy-microhei/wqy-microhei.ttc",
"/usr/share/fonts/wqy-zenhei/wqy-zenhei.ttc",
"C:/Windows/Fonts/msyh.ttc",
"C:/Windows/Fonts/simhei.ttf",
]
"""字体文件路径列表"""