初步完成插件的异步调用和向telegram bot发送信息

This commit is contained in:
lzybetter
2024-05-02 00:01:52 +08:00
parent b2065d1d01
commit 1bb48093ca
4 changed files with 80 additions and 118 deletions

View File

@@ -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]