初步完成插件的异步调用和向telegram bot发送信息
This commit is contained in:
@@ -31,7 +31,7 @@ class Config:
|
||||
|
||||
def get_scheduler_db_file_path(self):
|
||||
try:
|
||||
return os.path.join(self.__CONFIG_PATH, self.__CONFIG_DICT['SCHEDULER_DB_PATH'],
|
||||
return os.path.join(self.__BASE_PATH, self.__CONFIG_DICT['SCHEDULER_DB_PATH'],
|
||||
self.__SCHEDULER_DB_FILE_NAME)
|
||||
except:
|
||||
return os.path.join(self.__CONFIG_PATH, 'schedule_db', self.__SCHEDULER_DB_FILE_NAME)
|
||||
@@ -69,7 +69,14 @@ class Config:
|
||||
except:
|
||||
return default
|
||||
|
||||
def set_config(self, config_name, value):
|
||||
def set_config(self, config_name, value, config_path = ''):
|
||||
self.__CONFIG_DICT[config_name] = value
|
||||
with open(os.path.join(self.__CONFIG_PATH, self.__CONFIG_NAME), 'w') as f:
|
||||
f.write(yaml.safe_dump(self.__CONFIG_DICT, sort_keys=False))
|
||||
f.write(yaml.safe_dump(self.__CONFIG_DICT, sort_keys=False))
|
||||
|
||||
def get_plugin_config(self, config_name, config_path):
|
||||
print(config_path)
|
||||
if config_path != '':
|
||||
with open(os.path.join(config_path, self.__CONFIG_NAME)) as f:
|
||||
config_d = yaml.safe_load(f)
|
||||
return config_d[config_name]
|
||||
Reference in New Issue
Block a user