mirror of
https://github.com/Shu-Ying/main_plugin_farm.git
synced 2026-10-31 06:49:59 +08:00
add # 新增使用开源字体
This commit is contained in:
@@ -17,11 +17,14 @@ Windows双击主仓库根目录的`build_astrbot.cmd`,成功后控制台打印
|
||||
|
||||
## 配置与使用
|
||||
|
||||
管理面板支持`font_path`(中文字体)、`data_dir`、`image_format`及
|
||||
管理面板支持`resource_source`、`farm_service_url`、`image_format`及
|
||||
`image_quality`(整数1~95,默认75)。质量修改后下一次请求生效;
|
||||
其他配置修改后重载插件。默认数据目录为
|
||||
`data/plugin_data/astrbot_plugin_farm`,数据库与日志位于该目录,卸载
|
||||
插件前自行备份;更改目录不自动搬迁数据,旧数据不会被覆盖。
|
||||
其他配置修改后重载插件。字体使用小赖字体,默认数据目录为
|
||||
`data/plugin_data/astrbot_plugin_farm`。为兼容旧部署,继续读取已有的
|
||||
`data_dir` 配置;留空使用默认目录。不会自动搬动数据库,卸载前自行备份。
|
||||
素材或字体下载失败时停止本次资源加载,保留文字功能,不自动重试;
|
||||
重新加载插件后才会再次尝试。日志按配置、素材、字体或渲染器区分失败阶段,
|
||||
仅记录安全错误分类,不输出远程地址及异常正文。
|
||||
|
||||
按AstrBot配置的唤醒前缀发送,例如`/开通农场`、`/农场帮助`、
|
||||
`/我的农场`、`/种子商店`、`/我的种子 文字`、`/播种 白萝卜`、`/收获`。
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
{
|
||||
"data_dir": {
|
||||
"description": "兼容旧部署的数据目录",
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"hint": "保留原有自定义目录以继续读取旧存档;留空使用 AstrBot 默认目录。修改此项不会自动搬移数据库。"
|
||||
},
|
||||
"resource_source": {
|
||||
"description": "资源获取地址",
|
||||
"type": "string",
|
||||
@@ -12,18 +18,6 @@
|
||||
"default": "",
|
||||
"hint": "始终独立配置,用于资源及后续活动服务;选择farm_service获取素材时必填HTTPS基础地址。"
|
||||
},
|
||||
"font_path": {
|
||||
"description": "中文字体路径",
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"hint": "部署环境可访问的中文字体文件;留空时尝试系统字体,找不到则退回文字。"
|
||||
},
|
||||
"data_dir": {
|
||||
"description": "农场数据目录",
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"hint": "留空使用data/plugin_data/astrbot_plugin_farm。修改后重载插件;不会自动搬迁数据。"
|
||||
},
|
||||
"image_format": {
|
||||
"description": "图片格式",
|
||||
"type": "string",
|
||||
|
||||
@@ -33,8 +33,7 @@ class FarmPlugin(Star):
|
||||
if image_format not in ('AUTO', 'JPEG', 'PNG'):
|
||||
raise ValueError('image_format must be AUTO, JPEG or PNG')
|
||||
self.runtime = Runtime(
|
||||
data_dir, config.get('font_path') or None, 'astrbot',
|
||||
image_format, font_setting='font_path',
|
||||
data_dir, deployment='astrbot', image_format=image_format,
|
||||
image_quality=config.get('image_quality', 75),
|
||||
image_quality_provider=lambda: self.config.get('image_quality', 75),
|
||||
framework='astrbot',
|
||||
|
||||
Reference in New Issue
Block a user