mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-09-29 00:32:06 +08:00
fix web_ui api
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from configs.config import Config as gConfig
|
||||
from .manager import *
|
||||
from .api import *
|
||||
from .auth import *
|
||||
|
||||
|
||||
|
||||
@@ -67,8 +67,8 @@ def _(type_: Optional[str], user: User = Depends(token_to_user)) -> Result:
|
||||
if x := plugins2settings_manager.get(model):
|
||||
if x.get("cmd") and isinstance(x.get("cmd"), list):
|
||||
x["cmd"] = ",".join(x["cmd"])
|
||||
if isinstance(x["plugin_type"], list):
|
||||
x["plugin_type"] = x["plugin_type"][0]
|
||||
# if isinstance(x["plugin_type"], list):
|
||||
# x["plugin_type"] = x["plugin_type"][0]
|
||||
data["plugin_settings"] = PluginSettings(**x)
|
||||
if x := plugins2cd_manager.get(model):
|
||||
data["cd_limit"] = CdLimit(**x)
|
||||
@@ -88,14 +88,11 @@ def _(plugin: Plugin, user: User = Depends(token_to_user)) -> Result:
|
||||
修改插件信息
|
||||
:param plugin: 插件内容
|
||||
"""
|
||||
|
||||
print(plugin)
|
||||
if plugin.plugin_settings:
|
||||
for key, value in plugin.plugin_settings:
|
||||
plugins2settings_manager.set_module_data(plugin.model, key, value)
|
||||
if plugin.plugin_manager:
|
||||
for key, value in plugin.plugin_manager:
|
||||
print(key, value)
|
||||
plugins_manager.set_module_data(plugin.model, key, value)
|
||||
return Result(code=200)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Optional, List, Any
|
||||
from typing import Optional, List, Any, Union
|
||||
from pydantic import BaseModel
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
import nonebot
|
||||
@@ -54,7 +54,7 @@ class PluginSettings(BaseModel):
|
||||
limit_superuser: Optional[bool] # 是否限制超级用户
|
||||
cmd: Optional[str] # cmd别名
|
||||
cost_gold: Optional[int] # 花费金币限制
|
||||
plugin_type: Optional[str] # 帮助类型
|
||||
plugin_type: Optional[List[Union[str, int]]] # 帮助类型
|
||||
|
||||
|
||||
class Plugin(BaseModel):
|
||||
|
||||
Reference in New Issue
Block a user