From 67d71fd893b167481cd122b50d93b00b6370c040 Mon Sep 17 00:00:00 2001
From: Lint Action <noreply@github.com>
Date: Mon, 9 Aug 2021 16:17:55 +0000
Subject: =?UTF-8?q?:rotating=5Flight:=20=E8=87=AA=E5=8A=A8=E8=BF=9B?=
 =?UTF-8?q?=E8=A1=8C=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 ATRI/plugins/manege/data_source.py | 59 ++++++++++++++++----------------------
 1 file changed, 25 insertions(+), 34 deletions(-)

(limited to 'ATRI/plugins')

diff --git a/ATRI/plugins/manege/data_source.py b/ATRI/plugins/manege/data_source.py
index 0a5a93e..de9dfdb 100644
--- a/ATRI/plugins/manege/data_source.py
+++ b/ATRI/plugins/manege/data_source.py
@@ -29,7 +29,6 @@ __doc__ = """
 
 
 class Manege(Service):
-    
     def __init__(self):
         Service.__init__(self, "管理", __doc__, True)
 
@@ -54,8 +53,7 @@ class Manege(Service):
         except BaseException:
             data = dict()
         return data
-        
-    
+
     @staticmethod
     def _save_block_user_list(data: dict) -> None:
         file_name = "block_user.json"
@@ -63,10 +61,10 @@ class Manege(Service):
         if not path.is_file():
             with open(path, "w", encoding="utf-8") as w:
                 w.write(json.dumps({}))
-        
+
         with open(path, "w", encoding="utf-8") as w:
             w.write(json.dumps(data, indent=4))
-    
+
     @staticmethod
     def _load_block_group_list() -> dict:
         """
@@ -83,13 +81,13 @@ class Manege(Service):
             with open(path, "w", encoding="utf-8") as w:
                 w.write(json.dumps({}))
             return dict()
-        
+
         try:
             data = json.loads(path.read_bytes())
         except BaseException:
             data = dict()
         return data
-    
+
     @staticmethod
     def _save_block_group_list(data: dict) -> None:
         file_name = "block_group.json"
@@ -97,55 +95,51 @@ class Manege(Service):
         if not path.is_file():
             with open(path, "w", encoding="utf-8") as w:
                 w.write(json.dumps({}))
-        
+
         with open(path, "w", encoding="utf-8") as w:
             w.write(json.dumps(data, indent=4))
-    
+
     @classmethod
     def block_user(cls, user_id: str) -> bool:
         data = cls._load_block_user_list()
         now_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
-        data[user_id] = {
-            "time": now_time
-        }
+        data[user_id] = {"time": now_time}
         try:
             cls._save_block_user_list(data)
             return True
         except BaseException:
             return False
-    
+
     @classmethod
     def unblock_user(cls, user_id: str) -> bool:
         data: dict = cls._load_block_user_list()
         if user_id not in data:
             return False
-        
+
         try:
             data.pop(user_id)
             cls._save_block_user_list(data)
             return True
         except BaseException:
             return False
-    
+
     @classmethod
     def block_group(cls, group_id: str) -> bool:
         data = cls._load_block_group_list()
         now_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
-        data[group_id] = {
-            "time": now_time
-        }
+        data[group_id] = {"time": now_time}
         try:
             cls._save_block_group_list(data)
             return True
         except BaseException:
             return False
-    
+
     @classmethod
     def unblock_group(cls, group_id: str) -> bool:
         data: dict = cls._load_block_group_list()
         if group_id not in data:
             return False
-        
+
         try:
             data.pop(group_id)
             cls._save_block_group_list(data)
@@ -165,7 +159,7 @@ class Manege(Service):
         data["enabled"] = is_enabled
         ServiceTools().save_service(data, service)
         return True
-    
+
     @staticmethod
     def control_user_service(service: str, user_id: str, is_enabled: bool) -> bool:
         """
@@ -176,7 +170,7 @@ class Manege(Service):
         except BaseException:
             return False
         temp_list: list = data.get("disable_user", list())
-        
+
         if is_enabled:
             try:
                 temp_list.remove(user_id)
@@ -187,7 +181,7 @@ class Manege(Service):
         data["disable_user"] = temp_list
         ServiceTools().save_service(data, service)
         return True
-    
+
     @staticmethod
     def control_group_service(service: str, group_id: str, is_enabled: bool) -> bool:
         """
@@ -199,7 +193,7 @@ class Manege(Service):
         except BaseException:
             return False
         temp_list: list = data.get("disable_group", list())
-        
+
         if is_enabled:
             try:
                 temp_list.remove(group_id)
@@ -225,7 +219,7 @@ class Manege(Service):
         except BaseException:
             data = dict()
         return data
-    
+
     @staticmethod
     def save_friend_apply_list(data: dict) -> None:
         file_name = "friend_add.json"
@@ -236,7 +230,7 @@ class Manege(Service):
 
         with open(path, "w", encoding="utf-8") as w:
             w.write(json.dumps(data, indent=4))
-    
+
     @staticmethod
     def load_invite_apply_list() -> dict:
         file_name = "group_invite.json"
@@ -251,7 +245,7 @@ class Manege(Service):
         except BaseException:
             data = dict()
         return data
-    
+
     @staticmethod
     def save_invite_apply_list(data: dict) -> None:
         file_name = "group_invite.json"
@@ -269,22 +263,19 @@ class Manege(Service):
             data = load_error(track_id)
         except ReadFileError:
             return "请检查ID是否正确..."
-        
+
         prompt = data.get("prompt", "ignore")
         time = data.get("time", "ignore")
         content = data.get("content", "ignore")
-        
+
         msg0 = TRACK_BACK_FORMAT.format(
-            track_id=track_id,
-            prompt=prompt,
-            time=time,
-            content=content
+            track_id=track_id, prompt=prompt, time=time, content=content
         )
         f_data = FormData()
         f_data.add_field("poster", "ATRI running log")
         f_data.add_field("syntax", "text")
         f_data.add_field("expiration", "day")
         f_data.add_field("content", msg0)
-        
+
         repo = f"详细请移步此处~\n{await UbuntuPaste(f_data).paste()}"
         return repo
-- 
cgit v1.2.3