-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
35 lines (28 loc) · 857 Bytes
/
config.py
File metadata and controls
35 lines (28 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""
Author: flwfdd
Date: 2023-10-27 14:49:11
LastEditTime: 2023-10-27 23:21:29
Description: 配置文件
_(:з」∠)_
"""
from datetime import datetime
import json
# 单例模式
def singleton(cls):
_instance = {}
def inner():
if cls not in _instance:
_instance[cls] = cls()
return _instance[cls]
return inner
@singleton
class Config:
def __init__(self):
self.json = json.load(open("config.json", "r", encoding="utf-8"))
self.api_url = self.json["api_url"]
self.notices_url = self.json["notices_url"]
self.sources_url = self.json["sources_url"]
self.start_time = datetime.fromisoformat(self.json["start_time"])
self.sleep_minutes = self.json["sleep_minutes"]
self.zhipuai_api_key = self.json["zhipuai_api_key"]
self.bots = self.json["bots"]