From 5e9280d972e560577edde237e81bde704dd1d43e Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sun, 19 Nov 2023 12:37:20 +0100 Subject: [PATCH] Fixed loop timer #410 --- bot/src/modules/base/base_module.py | 4 +-- bot/src/modules/base/tasks/__init__.py | 26 +++++++++++++++++++ .../base/{ => tasks}/birthday_watcher.py | 0 .../{ => tasks}/scheduled_events_watcher.py | 2 +- 4 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 bot/src/modules/base/tasks/__init__.py rename bot/src/modules/base/{ => tasks}/birthday_watcher.py (100%) rename bot/src/modules/base/{ => tasks}/scheduled_events_watcher.py (99%) diff --git a/bot/src/modules/base/base_module.py b/bot/src/modules/base/base_module.py index df582b08..b0608515 100644 --- a/bot/src/modules/base/base_module.py +++ b/bot/src/modules/base/base_module.py @@ -7,7 +7,7 @@ from cpl_discord.service.discord_collection_abc import DiscordCollectionABC from bot_core.abc.module_abc import ModuleABC from bot_core.abc.task_abc import TaskABC from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum -from modules.base.birthday_watcher import BirthdayWatcher +from modules.base.tasks.birthday_watcher import BirthdayWatcher from modules.base.command.afk_command import AFKCommand from modules.base.command.game_server_group import GameServerGroup from modules.base.command.help_command import HelpCommand @@ -45,7 +45,7 @@ from modules.base.events.base_on_voice_state_update_event_scheduled_event_bonus from modules.base.forms.bug_report_form import BugReportForm from modules.base.forms.complaint_form import ComplaintForm from modules.base.helper.base_reaction_handler import BaseReactionHandler -from modules.base.scheduled_events_watcher import ScheduledEventsWatcher +from modules.base.tasks.scheduled_events_watcher import ScheduledEventsWatcher from modules.base.service.event_service import EventService from modules.base.service.user_warnings_service import UserWarningsService diff --git a/bot/src/modules/base/tasks/__init__.py b/bot/src/modules/base/tasks/__init__.py new file mode 100644 index 00000000..41959bff --- /dev/null +++ b/bot/src/modules/base/tasks/__init__.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +""" +bot sh-edraft.de Discord bot +~~~~~~~~~~~~~~~~~~~ + +Discord bot for customers of sh-edraft.de + +:copyright: (c) 2022 - 2023 sh-edraft.de +:license: MIT, see LICENSE for more details. + +""" + +__title__ = "modules.base.tasks" +__author__ = "Sven Heidemann" +__license__ = "MIT" +__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de" +__version__ = "1.2.2" + +from collections import namedtuple + + +# imports: + +VersionInfo = namedtuple("VersionInfo", "major minor micro") +version_info = VersionInfo(major="1", minor="2", micro="2") diff --git a/bot/src/modules/base/birthday_watcher.py b/bot/src/modules/base/tasks/birthday_watcher.py similarity index 100% rename from bot/src/modules/base/birthday_watcher.py rename to bot/src/modules/base/tasks/birthday_watcher.py diff --git a/bot/src/modules/base/scheduled_events_watcher.py b/bot/src/modules/base/tasks/scheduled_events_watcher.py similarity index 99% rename from bot/src/modules/base/scheduled_events_watcher.py rename to bot/src/modules/base/tasks/scheduled_events_watcher.py index dc2bb849..0c6738cb 100644 --- a/bot/src/modules/base/scheduled_events_watcher.py +++ b/bot/src/modules/base/tasks/scheduled_events_watcher.py @@ -66,7 +66,7 @@ class ScheduledEventsWatcher(TaskABC): return ts - @tasks.loop(minutes=1) + @tasks.loop(hours=24) async def watch(self): self._logger.info(__name__, "Watching scheduled events") try: