mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-04 03:10:01 +08:00
数据库中所有user_qq改名以及user_id和group_id改为字符串
This commit is contained in:
@@ -35,11 +35,11 @@ class StaticData(Generic[T]):
|
||||
elif file.name.endswith("yaml"):
|
||||
self._data = _yaml.load(f)
|
||||
|
||||
def set(self, key, value) -> NoReturn:
|
||||
def set(self, key, value):
|
||||
self._data[key] = value
|
||||
self.save()
|
||||
|
||||
def set_module_data(self, module, key, value, auto_save: bool = True) -> NoReturn:
|
||||
def set_module_data(self, module, key, value, auto_save: bool = True):
|
||||
if module in self._data.keys():
|
||||
self._data[module][key] = value
|
||||
if auto_save:
|
||||
@@ -51,7 +51,7 @@ class StaticData(Generic[T]):
|
||||
def keys(self) -> List[str]:
|
||||
return self._data.keys()
|
||||
|
||||
def delete(self, key) -> NoReturn:
|
||||
def delete(self, key):
|
||||
if self._data.get(key) is not None:
|
||||
del self._data[key]
|
||||
|
||||
@@ -105,3 +105,6 @@ class StaticData(Generic[T]):
|
||||
|
||||
def __getitem__(self, key) -> T:
|
||||
return self._data[key]
|
||||
|
||||
def __len__(self) -> int:
|
||||
return len(self._data)
|
||||
|
||||
+11
-4
@@ -35,10 +35,17 @@ class BaseData(BaseModel):
|
||||
群基本信息
|
||||
"""
|
||||
|
||||
white_group: List[int] = [] # 白名单
|
||||
close_task: List[str] = [] # 全局关闭的被动任务
|
||||
group_manager: Dict[str, BaseGroup] = {} # 群组管理
|
||||
task: Dict[str, str] = {} # 被动任务 【英文:中文】
|
||||
white_group: List[int] = []
|
||||
"""白名单"""
|
||||
close_task: List[str] = []
|
||||
"""全局关闭的被动任务"""
|
||||
group_manager: Dict[str, BaseGroup] = {}
|
||||
"""群组管理"""
|
||||
task: Dict[str, str] = {}
|
||||
"""被动任务 英文:中文名"""
|
||||
|
||||
def __len__(self) -> int:
|
||||
return len(self.group_manager)
|
||||
|
||||
|
||||
class PluginBlock(BaseModel):
|
||||
|
||||
Reference in New Issue
Block a user