From 0237064dd0d583203e0cac34ecc3254cc234626c Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Thu, 19 Oct 2023 02:07:36 +0800 Subject: [PATCH] Fix: Renew timer in interval_is_reached() only --- module/base/base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/module/base/base.py b/module/base/base.py index e819d4c0f..6cb006eaf 100644 --- a/module/base/base.py +++ b/module/base/base.py @@ -213,7 +213,7 @@ class ModuleBase: button_area = area_offset((-encourage, -encourage, encourage, encourage), offset=point) return ClickButton(area=button_area, name=name) - def get_interval_timer(self, button, interval=5) -> Timer: + def get_interval_timer(self, button, interval=5, renew=False) -> Timer: if hasattr(button, 'name'): name = button.name elif callable(button): @@ -223,7 +223,7 @@ class ModuleBase: try: timer = self.interval_timer[name] - if timer.limit != interval: + if renew and timer.limit != interval: timer = Timer(interval) self.interval_timer[name] = timer return timer @@ -251,7 +251,7 @@ class ModuleBase: self.get_interval_timer(button, interval=interval).clear() def interval_is_reached(self, button, interval=5): - return self.get_interval_timer(button, interval=interval).reached() + return self.get_interval_timer(button, interval=interval, renew=True).reached() _image_file = ''