fix: chat_time_module compatible logic

This commit is contained in:
zhayujie
2023-03-24 23:04:15 +08:00
parent f3daa8e3bf
commit ae06cf844d
2 changed files with 6 additions and 10 deletions

View File

@@ -5,11 +5,10 @@ from common.log import logger
def time_checker(f):
def _time_checker(self, *args, **kwargs):
_config = config.conf()
chat_time_module = _config["chat_time_module"]
chat_start_time = _config["chat_start_time"]
chat_stopt_time = _config["chat_stop_time"]
chat_time_module = _config.get("chat_time_module", False)
if chat_time_module:
chat_start_time = _config.get("chat_start_time", "00:00")
chat_stopt_time = _config.get("chat_stop_time", "24:00")
time_regex = re.compile(r'^([01]?[0-9]|2[0-4])(:)([0-5][0-9])$') #时间匹配包含24:00
starttime_format_check = time_regex.match(chat_start_time) # 检查停止时间格式