mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-02-25 08:57:51 +08:00
feat: move loading config method to base class
This commit is contained in:
@@ -29,15 +29,9 @@ class BDunit(Plugin):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
try:
|
||||
curdir = os.path.dirname(__file__)
|
||||
config_path = os.path.join(curdir, "config.json")
|
||||
conf = super().load_config()
|
||||
if not conf:
|
||||
if not os.path.exists(config_path):
|
||||
raise Exception("config.json not found")
|
||||
else:
|
||||
with open(config_path, "r") as f:
|
||||
conf = json.load(f)
|
||||
raise Exception("config.json not found")
|
||||
self.service_id = conf["service_id"]
|
||||
self.api_key = conf["api_key"]
|
||||
self.secret_key = conf["secret_key"]
|
||||
|
||||
Reference in New Issue
Block a user