fixed # 适配AstrBot

This commit is contained in:
2026-10-23 19:12:16 +08:00
parent d0c1741940
commit 685cff9293
49 changed files with 1557 additions and 165 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
发布目标:https://github.com/Shu-Ying/nonebot_plugin_farm.git
本目录负责命令、统一会话、消息、配置与启停,不导入真寻。
运行时在打包时复用 `integrations/zhenxun/runtime.py`,核心和渲染模块
运行时在打包时复用 `integrations/shared/runtime.py`,核心和渲染模块
按白名单私有化。此源码目录不能直接加载,需先构建生成仓库。
`python scripts/build_nonebot.py --output dist/nonebot-preview` 生成标准
+3 -2
View File
@@ -9,10 +9,11 @@ require("nonebot_plugin_localstore")
from ._version import __version__
from .config import Config
from .runtime import HELP
from .runtime import command_specs, help_text
__plugin_meta__ = PluginMetadata(
name="农场", description="快乐的农场时光", usage=HELP,
name="农场", description="快乐的农场时光",
usage=help_text(command_specs('nonebot')),
type="application", config=Config,
homepage="https://github.com/Shu-Ying/nonebot_plugin_farm",
supported_adapters=inherit_supported_adapters(
+6 -1
View File
@@ -12,7 +12,9 @@ from nonebot_plugin_uninfo import Uninfo
from .config import Config
from .data_paths import data_directory
from .runtime import COMMANDS, Runtime
from .runtime import Runtime, command_map
COMMANDS = command_map('nonebot')
logger = logging.getLogger(__name__)
config = get_plugin_config(Config)
@@ -22,6 +24,9 @@ runtime = Runtime(
config.farm_font, config.farm_deployment, config.farm_image_format,
font_setting="FARM_FONT",
image_quality=config.farm_image_quality,
framework='nonebot',
resource_source=config.farm_resource_source,
service_url=config.farm_service_url,
)
driver.on_startup(runtime.start)
driver.on_shutdown(runtime.close)
+6
View File
@@ -25,3 +25,9 @@ class Config(BaseModel):
75,
description="全部农场图片编码质量;仅我的农场高清时至少85",
)
farm_resource_source: Literal['Github', 'Gitea', 'farm_service'] = Field(
'Github', description='资源获取地址,修改后重载插件',
)
farm_service_url: str = Field(
'', description='farm_service 地址,独立供资源及活动服务使用',
)