summaryrefslogtreecommitdiff
path: root/ATRI
diff options
context:
space:
mode:
authorKyomotoi <[email protected]>2022-04-04 17:09:31 +0800
committerKyomotoi <[email protected]>2022-04-05 15:27:21 +0800
commit080df928cb3fa8b23481211c8c1072453e89b774 (patch)
tree3a07430a802e44bce5a1925182a3007fc365a217 /ATRI
parentf1ce42da9027f416561ecabe34e0f5592bdfdd3e (diff)
downloadATRI-080df928cb3fa8b23481211c8c1072453e89b774.tar.gz
ATRI-080df928cb3fa8b23481211c8c1072453e89b774.tar.bz2
ATRI-080df928cb3fa8b23481211c8c1072453e89b774.zip
🚸 增加对部分插件所需key的填写检查
Diffstat (limited to 'ATRI')
-rw-r--r--ATRI/plugins/saucenao/data_source.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/ATRI/plugins/saucenao/data_source.py b/ATRI/plugins/saucenao/data_source.py
index 738c647..9e2bd75 100644
--- a/ATRI/plugins/saucenao/data_source.py
+++ b/ATRI/plugins/saucenao/data_source.py
@@ -1,9 +1,11 @@
from random import choice
-from ATRI.service import Service
+from ATRI.service import Service, ServiceTools
from ATRI.rule import is_in_service
from ATRI.exceptions import RequestError
from ATRI.utils import request
+from ATRI.config import SauceNAO as sa
+from ATRI.log import logger as log
URL = "https://saucenao.com/search.php"
@@ -21,6 +23,12 @@ class SaouceNao(Service):
):
Service.__init__(self, "以图搜图", "以图搜图,仅限二刺螈", rule=is_in_service("以图搜图"))
+ if not sa.key:
+ data = ServiceTools.load_service("以图搜图")
+ data["enabled"] = False
+ ServiceTools.save_service(data, "以图搜图")
+ log.warning("key 未配置,本插件将被禁用")
+
params = dict()
params["api_key"] = api_key
params["output_type"] = output_type