diff options
Diffstat (limited to 'ATRI/plugins/manage')
-rw-r--r-- | ATRI/plugins/manage/__init__.py | 8 | ||||
-rw-r--r-- | ATRI/plugins/manage/data_source.py | 30 |
2 files changed, 19 insertions, 19 deletions
diff --git a/ATRI/plugins/manage/__init__.py b/ATRI/plugins/manage/__init__.py index befbdf1..672ba97 100644 --- a/ATRI/plugins/manage/__init__.py +++ b/ATRI/plugins/manage/__init__.py @@ -290,7 +290,7 @@ async def _deal_approve_friend_add( try: await bot.set_friend_add_request(flag=apply_code, approve=True) - except BaseException: + except Exception: await approve_friend_add.finish("同意失败...尝试下手动?") data = Manage().load_friend_apply_list() data.pop(apply_code) @@ -320,7 +320,7 @@ async def _deal_refuse_friend_add( try: await bot.set_friend_add_request(flag=apply_code, approve=False) - except BaseException: + except Exception: await refuse_friend_add.finish("拒绝失败...尝试下手动?") data = Manage().load_friend_apply_list() data.pop(apply_code) @@ -371,7 +371,7 @@ async def _deal_approve_group_invite( await bot.set_group_add_request( flag=apply_code, sub_type="invite", approve=True ) - except BaseException: + except Exception: await approve_group_invite.finish("同意失败...尝试下手动?") data = Manage().load_invite_apply_list() data.pop(apply_code) @@ -403,7 +403,7 @@ async def _deal_refuse_group_invite( await bot.set_group_add_request( flag=apply_code, sub_type="invite", approve=False ) - except BaseException: + except Exception: await refuse_group_invite.finish("拒绝失败...(可能是小群免验证)尝试下手动?") data = Manage().load_invite_apply_list() data.pop(apply_code) diff --git a/ATRI/plugins/manage/data_source.py b/ATRI/plugins/manage/data_source.py index 1d870e6..92dcc42 100644 --- a/ATRI/plugins/manage/data_source.py +++ b/ATRI/plugins/manage/data_source.py @@ -3,7 +3,7 @@ from pathlib import Path from datetime import datetime from ATRI.service import Service, ServiceTools -from ATRI.exceptions import ReadFileError, load_error +from ATRI.exceptions import load_error MANAGE_DIR = Path(".") / "data" / "database" / "manege" @@ -41,7 +41,7 @@ class Manage(Service): return dict() try: data = json.loads(path.read_bytes()) - except BaseException: + except Exception: data = dict() return data @@ -75,7 +75,7 @@ class Manage(Service): try: data = json.loads(path.read_bytes()) - except BaseException: + except Exception: data = dict() return data @@ -98,7 +98,7 @@ class Manage(Service): try: cls._save_block_user_list(data) return True - except BaseException: + except Exception: return False @classmethod @@ -111,7 +111,7 @@ class Manage(Service): data.pop(user_id) cls._save_block_user_list(data) return True - except BaseException: + except Exception: return False @classmethod @@ -122,7 +122,7 @@ class Manage(Service): try: cls._save_block_group_list(data) return True - except BaseException: + except Exception: return False @classmethod @@ -135,7 +135,7 @@ class Manage(Service): data.pop(group_id) cls._save_block_group_list(data) return True - except BaseException: + except Exception: return False @staticmethod @@ -145,7 +145,7 @@ class Manage(Service): """ try: data = ServiceTools().load_service(service) - except BaseException: + except Exception: return False data["enabled"] = is_enabled ServiceTools().save_service(data, service) @@ -158,14 +158,14 @@ class Manage(Service): """ try: data = ServiceTools().load_service(service) - except BaseException: + except Exception: return False temp_list: list = data.get("disable_user", list()) if is_enabled: try: temp_list.remove(user_id) - except BaseException: + except Exception: return False else: if user_id in temp_list: @@ -185,14 +185,14 @@ class Manage(Service): """ try: data = ServiceTools().load_service(service) - except: + except Exception: return False temp_list: list = data.get("disable_group", list()) if is_enabled: try: temp_list.remove(group_id) - except: + except Exception: return False else: if group_id in temp_list: @@ -215,7 +215,7 @@ class Manage(Service): try: data = json.loads(path.read_bytes()) - except: + except Exception: data = dict() return data @@ -241,7 +241,7 @@ class Manage(Service): try: data = json.loads(path.read_bytes()) - except BaseException: + except Exception: data = dict() return data @@ -260,7 +260,7 @@ class Manage(Service): async def track_error(track_id: str) -> str: try: data = load_error(track_id) - except ReadFileError: + except Exception: return "请检查ID是否正确..." prompt = data.get("prompt", "ignore") |