summaryrefslogtreecommitdiff
path: root/ATRI/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'ATRI/plugins')
-rw-r--r--ATRI/plugins/anti_effort/data_source.py2
-rw-r--r--ATRI/plugins/console/driver/data_source.py4
-rw-r--r--ATRI/plugins/help/data_source.py4
-rw-r--r--ATRI/plugins/manage/data_source.py12
-rw-r--r--ATRI/plugins/polaroid/data_source.py2
-rw-r--r--ATRI/plugins/saucenao/__init__.py2
-rw-r--r--ATRI/plugins/twitter/data_source.py2
7 files changed, 14 insertions, 14 deletions
diff --git a/ATRI/plugins/anti_effort/data_source.py b/ATRI/plugins/anti_effort/data_source.py
index 2d04823..89b8ae2 100644
--- a/ATRI/plugins/anti_effort/data_source.py
+++ b/ATRI/plugins/anti_effort/data_source.py
@@ -258,7 +258,7 @@ async def init_source():
with open(file_path, "wb") as f:
f.write(data.read()) # type: ignore
except Exception:
- ServiceTools.service_controller("谁是卷王", False)
+ ServiceTools("谁是卷王").service_controller(False)
log.error(f"插件 anti_effort 装载资源失败. 已自动禁用")
log.success("插件 anti_effort 装载资源完成")
diff --git a/ATRI/plugins/console/driver/data_source.py b/ATRI/plugins/console/driver/data_source.py
index 12fb938..45b07e6 100644
--- a/ATRI/plugins/console/driver/data_source.py
+++ b/ATRI/plugins/console/driver/data_source.py
@@ -87,7 +87,7 @@ def get_service_list() -> dict:
def edit_service(
service: str, global_enabled: int, enabled: bool, user_id: str, group_id: str
):
- data = ServiceTools.load_service(service)
+ data = ServiceTools(service).load_service()
if global_enabled != 2 and global_enabled:
data.enabled = bool(global_enabled)
@@ -115,7 +115,7 @@ def edit_service(
else:
return {"detail": "群已存在于禁用名单"}
- ServiceTools.save_service(data.dict(), service)
+ ServiceTools(service).save_service(data.dict())
return {"detail": "操作完成~"}
diff --git a/ATRI/plugins/help/data_source.py b/ATRI/plugins/help/data_source.py
index 3386a74..fb99313 100644
--- a/ATRI/plugins/help/data_source.py
+++ b/ATRI/plugins/help/data_source.py
@@ -84,7 +84,7 @@ class Helper:
@staticmethod
def service_info(service: str) -> str:
try:
- data = ServiceTools().load_service(service)
+ data = ServiceTools(service).load_service()
except Exception:
return "请检查是否输入错误呢...@bot 帮助 (服务)"
@@ -106,7 +106,7 @@ class Helper:
@staticmethod
def cmd_info(service: str, cmd: str) -> str:
try:
- data = ServiceTools().load_service(service)
+ data = ServiceTools(service).load_service()
except Exception:
return "请检查是否输入错误..."
diff --git a/ATRI/plugins/manage/data_source.py b/ATRI/plugins/manage/data_source.py
index e015805..ff344e7 100644
--- a/ATRI/plugins/manage/data_source.py
+++ b/ATRI/plugins/manage/data_source.py
@@ -144,11 +144,11 @@ class Manage:
Only SUPERUSER.
"""
try:
- data = ServiceTools().load_service(service)
+ data = ServiceTools(service).load_service()
except Exception:
return False
data.enabled = is_enabled
- ServiceTools().save_service(data.dict(), service)
+ ServiceTools(service).save_service(data.dict())
return True
@staticmethod
@@ -157,7 +157,7 @@ class Manage:
Only SUPERUSER.
"""
try:
- data = ServiceTools().load_service(service)
+ data = ServiceTools(service).load_service()
except Exception:
return False
temp_list: list = data.disable_user
@@ -174,7 +174,7 @@ class Manage:
temp_list.append(user_id)
data.disable_user = temp_list
- ServiceTools().save_service(data.dict(), service)
+ ServiceTools(service).save_service(data.dict())
return True
@staticmethod
@@ -184,7 +184,7 @@ class Manage:
Only current group.
"""
try:
- data = ServiceTools().load_service(service)
+ data = ServiceTools(service).load_service()
except Exception:
return False
temp_list: list = data.disable_group
@@ -201,7 +201,7 @@ class Manage:
temp_list.append(group_id)
data.disable_group = temp_list
- ServiceTools().save_service(data.dict(), service)
+ ServiceTools(service).save_service(data.dict())
return True
@staticmethod
diff --git a/ATRI/plugins/polaroid/data_source.py b/ATRI/plugins/polaroid/data_source.py
index e994c5e..37f3904 100644
--- a/ATRI/plugins/polaroid/data_source.py
+++ b/ATRI/plugins/polaroid/data_source.py
@@ -47,7 +47,7 @@ async def init_source():
with open(path, "wb") as w:
w.write(data.read()) # type: ignore
except Exception:
- ServiceTools.service_controller("拍立得", False)
+ ServiceTools("拍立得").service_controller(False)
log.error(f"插件 polaroid 装载资源失败. 已自动禁用")
log.success("插件 polaroid 装载资源完成")
diff --git a/ATRI/plugins/saucenao/__init__.py b/ATRI/plugins/saucenao/__init__.py
index b653a13..52cd93e 100644
--- a/ATRI/plugins/saucenao/__init__.py
+++ b/ATRI/plugins/saucenao/__init__.py
@@ -24,7 +24,7 @@ async def _deal_search(event: MessageEvent):
# cache fix
if not conf.SauceNAO.key:
- ServiceTools.service_controller("以图搜图", False)
+ ServiceTools("以图搜图").service_controller(False)
log.warning("插件 SauceNao 所需的 key 未配置,将被全局禁用,后续填写请手动启用")
user_id = event.get_user_id()
diff --git a/ATRI/plugins/twitter/data_source.py b/ATRI/plugins/twitter/data_source.py
index c735b1f..d1dd8d5 100644
--- a/ATRI/plugins/twitter/data_source.py
+++ b/ATRI/plugins/twitter/data_source.py
@@ -146,7 +146,7 @@ async def _check_status():
await _regot_in_need()
scheduler.add_job(_regot_in_need, "interval", name="刷新推特凭据", minutes=30, misfire_grace_time=10) # type: ignore
except Exception:
- ServiceTools.service_controller("推特动态订阅", False)
+ ServiceTools("推特动态订阅").service_controller(False)
log.warning("无法连接至 Twitter,这将导致相关插件无法工作. 已自动禁用.")