From 8729ba0821a04eb209ec7f69ec269cca20da4bf2 Mon Sep 17 00:00:00 2001 From: thsrite Date: Tue, 2 Apr 2024 11:39:32 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E9=9A=8F=E6=9C=BA=E5=BB=B6=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/customcommand/__init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/customcommand/__init__.py b/plugins/customcommand/__init__.py index 22e008b..2dd55cd 100644 --- a/plugins/customcommand/__init__.py +++ b/plugins/customcommand/__init__.py @@ -79,11 +79,15 @@ class CustomCommand(_PluginBase): # 保存配置 self.__update_config() else: + random_delay = None + if str(time_conf).count("#") == 3: + random_delay = conf[3] try: self._scheduler.add_job(func=self.__execute_command, trigger=CronTrigger.from_crontab(str(cron)), - name=name + (f"随机延时{conf[3]}秒" if conf[3] else ""), - args=[name, command, conf[3]]) + name=name + ( + f"随机延时{random_delay}秒" if random_delay else ""), + args=[name, command, random_delay]) except Exception as err: logger.error(f"定时任务配置错误:{err}") # 推送实时消息