diff options
-rw-r--r-- | ATRI/permission.py | 2 | ||||
-rw-r--r-- | ATRI/plugins/console/driver/api.py | 4 | ||||
-rw-r--r-- | ATRI/plugins/essential/data_source.py | 6 | ||||
-rw-r--r-- | ATRI/plugins/essential/listener.py | 8 | ||||
-rw-r--r-- | ATRI/service.py | 4 | ||||
-rw-r--r-- | ATRI/utils/__init__.py | 2 |
6 files changed, 14 insertions, 12 deletions
diff --git a/ATRI/permission.py b/ATRI/permission.py index 97eb6b6..ccb3f18 100644 --- a/ATRI/permission.py +++ b/ATRI/permission.py @@ -71,4 +71,4 @@ class Admin: init_permission() MASTER = Permission(MasterList()).set_name("Master") -ADMIN = Permission(Admin()).set_name("Admin")
\ No newline at end of file +ADMIN = Permission(Admin()).set_name("Admin") diff --git a/ATRI/plugins/console/driver/api.py b/ATRI/plugins/console/driver/api.py index 4b78906..4319954 100644 --- a/ATRI/plugins/console/driver/api.py +++ b/ATRI/plugins/console/driver/api.py @@ -79,7 +79,9 @@ def block_list_info(_=Depends(http_author)): return {"status": status.HTTP_200_OK, "data": get_block_list()} -def edit_block_list(enabled: str, user_id: str = str(), group_id: str = str(), _=Depends(http_author)): +def edit_block_list( + enabled: str, user_id: str = str(), group_id: str = str(), _=Depends(http_author) +): return { "status": status.HTTP_200_OK, "data": _edit_block_list(bool(int(enabled)), user_id, group_id), diff --git a/ATRI/plugins/essential/data_source.py b/ATRI/plugins/essential/data_source.py index 8274db0..d158c70 100644 --- a/ATRI/plugins/essential/data_source.py +++ b/ATRI/plugins/essential/data_source.py @@ -7,7 +7,7 @@ from ATRI.message import MessageSegment def recall_msg_dealer(message: Union[dict, str]) -> str: if isinstance(message, str): return message - + cache_list = list() for i in message: _type = i.get("type") @@ -25,5 +25,5 @@ def recall_msg_dealer(message: Union[dict, str]) -> str: cache_list.append(MessageSegment.face(_data["id"])) else: cache_list.append(f"[未知类型信息: {_data}]") - - return str().join(map(str, cache_list))
\ No newline at end of file + + return str().join(map(str, cache_list)) diff --git a/ATRI/plugins/essential/listener.py b/ATRI/plugins/essential/listener.py index fd05cba..e342ada 100644 --- a/ATRI/plugins/essential/listener.py +++ b/ATRI/plugins/essential/listener.py @@ -17,13 +17,13 @@ async def _(event: MessageEvent): if not blockuser_file_path.is_file(): with open(blockuser_file_path, "w", encoding="utf-8") as w: w.write(json.dumps(dict())) - + data = json.loads(blockuser_file_path.read_bytes()) - + user_id = event.get_user_id() if user_id in data: raise IgnoredException(f"Blocked user: {user_id}") - + if isinstance(event, GroupMessageEvent): blockgroup_file_path = __MANEGE_DIR / "block_group.json" if not blockgroup_file_path.is_file(): @@ -31,7 +31,7 @@ async def _(event: MessageEvent): w.write(json.dumps(dict())) data = json.loads(blockgroup_file_path.read_bytes()) - + group_id = str(event.group_id) if group_id in data: raise IgnoredException(f"Blocked group: {group_id}") diff --git a/ATRI/service.py b/ATRI/service.py index ff7b1e5..5a9b3b1 100644 --- a/ATRI/service.py +++ b/ATRI/service.py @@ -96,7 +96,7 @@ class Service: self._only_master = _is self._permission = MASTER - + return self def rule(self, rule: Optional[Union[Rule, T_RuleChecker]]) -> "Service": @@ -359,7 +359,7 @@ class Service: del kwargs["aliases"] return self.on_command(_cmd, docs, **kwargs) - + @staticmethod async def send_to_master(message: Union[str, Message]): bot = get_bot() diff --git a/ATRI/utils/__init__.py b/ATRI/utils/__init__.py index 29858f2..aeeb9db 100644 --- a/ATRI/utils/__init__.py +++ b/ATRI/utils/__init__.py @@ -148,7 +148,7 @@ class FileDealer: async def readtable(self): tar = await self._reader() return tar.readable() - + def json(self) -> dict: return json.loads(self.path.read_bytes()) |