mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-07 04:40:00 +08:00
Config提供type字段确定配置项类型
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
from configs.config import Config
|
||||
from configs.path_config import IMAGE_PATH
|
||||
from pathlib import Path
|
||||
from typing import List, Tuple
|
||||
|
||||
import nonebot
|
||||
|
||||
from configs.config import Config
|
||||
from configs.path_config import IMAGE_PATH
|
||||
|
||||
Config.add_plugin_config(
|
||||
"image_management",
|
||||
@@ -11,6 +13,7 @@ Config.add_plugin_config(
|
||||
name="图库操作",
|
||||
help_="公开图库列表,可自定义添加 [如果含有send_setu插件,请不要添加色图库]",
|
||||
default_value=[],
|
||||
type=List[str],
|
||||
)
|
||||
|
||||
Config.add_plugin_config(
|
||||
@@ -20,6 +23,7 @@ Config.add_plugin_config(
|
||||
name="图库操作",
|
||||
help_="自动撤回,参1:延迟撤回发送图库图片的时间(秒),0 为关闭 | 参2:监控聊天类型,0(私聊) 1(群聊) 2(群聊+私聊)",
|
||||
default_value=(0, 1),
|
||||
type=Tuple[int, int],
|
||||
)
|
||||
|
||||
Config.add_plugin_config(
|
||||
@@ -28,6 +32,7 @@ Config.add_plugin_config(
|
||||
7,
|
||||
help_="删除图库图片需要的管理员等级",
|
||||
default_value=7,
|
||||
type=int,
|
||||
)
|
||||
|
||||
Config.add_plugin_config(
|
||||
@@ -36,6 +41,7 @@ Config.add_plugin_config(
|
||||
7,
|
||||
help_="移动图库图片需要的管理员等级",
|
||||
default_value=7,
|
||||
type=int,
|
||||
)
|
||||
|
||||
Config.add_plugin_config(
|
||||
@@ -44,6 +50,7 @@ Config.add_plugin_config(
|
||||
6,
|
||||
help_="上传图库图片需要的管理员等级",
|
||||
default_value=6,
|
||||
type=int,
|
||||
)
|
||||
|
||||
Config.add_plugin_config(
|
||||
@@ -51,11 +58,12 @@ Config.add_plugin_config(
|
||||
"SHOW_ID",
|
||||
True,
|
||||
help_="是否消息显示图片下标id",
|
||||
default_value=True
|
||||
default_value=True,
|
||||
type=bool,
|
||||
)
|
||||
|
||||
|
||||
(IMAGE_PATH / "image_management").mkdir(parents=True, exist_ok=True)
|
||||
|
||||
|
||||
nonebot.load_plugins("plugins/image_management")
|
||||
nonebot.load_plugins(str(Path(__file__).parent.resolve()))
|
||||
|
||||
@@ -13,11 +13,6 @@ from utils.utils import FreqLimiter, cn2py, get_message_text, is_number
|
||||
|
||||
from .rule import rule
|
||||
|
||||
try:
|
||||
import ujson as json
|
||||
except ModuleNotFoundError:
|
||||
import json
|
||||
|
||||
__zx_plugin_name__ = "本地图库"
|
||||
__plugin_usage__ = f"""
|
||||
usage:
|
||||
@@ -36,16 +31,12 @@ __plugin_settings__ = {
|
||||
"level": 5,
|
||||
"default_status": True,
|
||||
"limit_superuser": False,
|
||||
"cmd": ["发送图片"] + Config.get_config("image_management", "IMAGE_DIR_LIST"),
|
||||
"cmd": ["发送图片"] + (Config.get_config("image_management", "IMAGE_DIR_LIST") or []),
|
||||
}
|
||||
__plugin_resources__ = {"pa": IMAGE_PATH / "pa"}
|
||||
|
||||
Config.add_plugin_config(
|
||||
"_task",
|
||||
"DEFAULT_PA",
|
||||
True,
|
||||
help_="被动 爬 进群默认开关状态",
|
||||
default_value=True,
|
||||
"_task", "DEFAULT_PA", True, help_="被动 爬 进群默认开关状态", default_value=True, type=int
|
||||
)
|
||||
|
||||
_flmt = FreqLimiter(1)
|
||||
|
||||
Reference in New Issue
Block a user