Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
HibiKier committed Feb 27, 2023
1 parent 8133b61 commit 6826c10
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
15 changes: 9 additions & 6 deletions utils/manager/group_manager.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import copy
from typing import List, Union, Dict, Callable, Any, Optional
from pathlib import Path
from .models import BaseData, BaseGroup
from utils.manager.data_class import StaticData
from utils.utils import get_matchers, is_number
from configs.config import Config
from typing import Any, Callable, Dict, List, Optional, Union

import nonebot
import ujson as json

from configs.config import Config
from utils.manager.data_class import StaticData
from utils.utils import get_matchers, is_number

from .models import BaseData, BaseGroup

Config.add_plugin_config(
"group_manager", "DEFAULT_GROUP_LEVEL", 5, help_="默认群权限", default_value=5
"group_manager", "DEFAULT_GROUP_LEVEL", 5, help_="默认群权限", default_value=5, type=int
)

Config.add_plugin_config(
Expand All @@ -19,6 +21,7 @@
True,
help_="默认进群总开关状态",
default_value=True,
type=bool
)


Expand Down
11 changes: 7 additions & 4 deletions utils/manager/models.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
from enum import Enum
from pathlib import Path
from typing import List, Optional, Dict, Literal, Tuple, Union, Any
from typing import Any, Dict, List, Literal, Optional, Tuple, Union

from pydantic import BaseModel

from configs.config import Config
from enum import Enum
from configs.utils import Config as zConfig


class AdminSetting(BaseModel):
Expand Down Expand Up @@ -33,7 +36,7 @@ class BaseData(BaseModel):
"""

white_group: List[int] = [] # 白名单
close_task: List[str] = [] # 全局关闭的被动任务
close_task: List[str] = [] # 全局关闭的被动任务
group_manager: Dict[str, BaseGroup] = {} # 群组管理
task: Dict[str, str] = {} # 被动任务 【英文:中文】

Expand Down Expand Up @@ -123,7 +126,7 @@ class PluginData(BaseModel):
plugin_block: Optional[PluginBlock]
plugin_count: Optional[PluginCount]
plugin_resources: Optional[Dict[str, Union[str, Path]]]
plugin_configs: Optional[Dict[str, Dict[str, Any]]]
plugin_configs: Optional[Dict[str, zConfig]]
plugin_status: Plugin

class Config:
Expand Down
8 changes: 2 additions & 6 deletions utils/manager/plugin_data_manager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Dict, Any, Optional
from typing import Any, Dict, Optional

from . import StaticData
from .models import PluginData
Expand Down Expand Up @@ -27,9 +27,5 @@ def add_plugin_info(self, info: PluginData):
def get(self, item: str, default: Any = None) -> PluginData:
return self._data.get(item, default)

def __getitem__(self, item) -> PluginData:
def __getitem__(self, item) -> Optional[PluginData]:
return self._data.get(item)




0 comments on commit 6826c10

Please sign in to comment.