40 lines
1.6 KiB
Python
40 lines
1.6 KiB
Python
"""搜图 —— 入口(元数据 + 配置注册)。"""
|
|
|
|
from nonebot import require
|
|
from nonebot.plugin import PluginMetadata
|
|
|
|
require("nonebot_plugin_alconna")
|
|
|
|
__plugin_meta__ = PluginMetadata(
|
|
name="搜图",
|
|
description="SauceNAO + ascii2d 二次元搜图",
|
|
usage=(
|
|
"(xx为bot名称)\n"
|
|
"[@bot+图片] 单张/多张搜图\n"
|
|
"[xx搜图] 进入批量搜图模式\n"
|
|
"[谢谢xx] 退出批量搜图模式"
|
|
),
|
|
type="application",
|
|
)
|
|
|
|
# 统一配置标准:把「插件内部常量」也暴露给 Web 管理台(来源无关)。
|
|
from hexi.web_hub.config_standard import register_config_items # noqa: E402
|
|
from . import config as _cfgmod # noqa: E402
|
|
|
|
register_config_items(
|
|
__name__,
|
|
[
|
|
{"key": "SAUCENAO_KEY", "label": "SauceNAO API Key", "type": "password", "secret": True},
|
|
{"key": "DAILY_LIMIT", "label": "每日搜图限额", "type": "int", "default": 50},
|
|
{"key": "SEARCH_TIMEOUT", "label": "批量搜索超时(秒)", "type": "int", "default": 60},
|
|
{"key": "CHECK", "label": "开启截屏判定", "type": "bool", "default": True},
|
|
{"key": "THUMB_ON", "label": "启用缩略图", "type": "bool", "default": True},
|
|
{"key": "CHAIN_REPLY", "label": "合并转发回复", "type": "bool", "default": True},
|
|
{"key": "IGNORE_STAMP", "label": "批量忽略表情包", "type": "bool", "default": True},
|
|
{"key": "threshold", "label": "相似度阈值", "type": "float", "default": 70},
|
|
],
|
|
store=_cfgmod,
|
|
)
|
|
|
|
from .handlers import pic_private, picmessage, replymessage, start_finder, thanks # noqa: E402,F401
|