mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-14 21:52:56 +08:00
✨ 插件配置新增is_show控制是否显示在菜单中 (#1749)
This commit is contained in:
parent
d00412e7fb
commit
c7c759f2b1
@ -29,6 +29,7 @@ __plugin_meta__ = PluginMetadata(
|
||||
author="HibiKier",
|
||||
version="0.1",
|
||||
plugin_type=PluginType.DEPENDANT,
|
||||
is_show=False,
|
||||
configs=[
|
||||
RegisterConfig(
|
||||
key="type",
|
||||
|
||||
@ -13,6 +13,7 @@ async def sort_type() -> dict[str, list[PluginInfo]]:
|
||||
menu_type__not="",
|
||||
load_status=True,
|
||||
plugin_type__in=[PluginType.NORMAL, PluginType.DEPENDANT],
|
||||
is_show=True,
|
||||
)
|
||||
sort_data = {}
|
||||
for plugin in data:
|
||||
|
||||
@ -136,6 +136,7 @@ async def _():
|
||||
"version",
|
||||
"admin_level",
|
||||
"plugin_type",
|
||||
"is_show",
|
||||
]
|
||||
)
|
||||
update_list.append(plugin)
|
||||
|
||||
@ -203,6 +203,8 @@ class PluginExtraData(BaseModel):
|
||||
"""额外名称"""
|
||||
sql_list: list[str] | None = None
|
||||
"""常用sql"""
|
||||
is_show: bool = True
|
||||
"""是否显示在菜单中"""
|
||||
|
||||
|
||||
class NoSuchConfig(Exception):
|
||||
|
||||
@ -48,6 +48,8 @@ class PluginInfo(Model):
|
||||
"""是否删除"""
|
||||
parent = fields.CharField(max_length=255, null=True, description="父插件")
|
||||
"""父插件"""
|
||||
is_show = fields.BooleanField(default=True, description="是否显示在帮助中")
|
||||
"""是否显示在帮助中"""
|
||||
|
||||
class Meta: # type: ignore
|
||||
table = "plugin_info"
|
||||
@ -81,4 +83,5 @@ class PluginInfo(Model):
|
||||
async def _run_script(cls):
|
||||
return [
|
||||
"ALTER TABLE plugin_info ADD COLUMN parent character varying(255);",
|
||||
"ALTER TABLE plugin_info ADD COLUMN is_show boolean DEFAULT true;",
|
||||
]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user