9 Commits

Author SHA1 Message Date
db61a764eb Merge pull request 'staging' (#447) from staging into master
All checks were successful
Deploy prod on push / on-push-deploy_sh-edraft (push) Successful in 3m45s
Reviewed-on: #447
2023-12-02 19:34:22 +01:00
919eef79f6 Merge branch 'master' into staging
All checks were successful
Deploy staging on push / on-push-deploy_sh-edraft (push) Successful in 3m58s
2023-12-02 19:33:58 +01:00
a2dd447dbd Always check scheduled_events after scheduled_event update #410
All checks were successful
Deploy staging on push / on-push-deploy_sh-edraft (push) Successful in 4m26s
Deploy dev on push / on-push-deploy_sh-edraft (push) Successful in 3m33s
2023-12-02 15:32:16 +01:00
8a76b46165 Improved event time loading #410
All checks were successful
Deploy dev on push / on-push-deploy_sh-edraft (push) Successful in 5m12s
Deploy staging on push / on-push-deploy_sh-edraft (push) Successful in 3m40s
2023-12-02 15:24:13 +01:00
af3084ad36 Fixed scheduled event end update #410
All checks were successful
Deploy staging on push / on-push-deploy_sh-edraft (push) Successful in 4m41s
Deploy dev on push / on-push-deploy_sh-edraft (push) Successful in 3m39s
2023-12-01 21:04:29 +01:00
285b8bdbe4 Fixed scheduled events #410
All checks were successful
Deploy staging on push / on-push-deploy_sh-edraft (push) Successful in 4m44s
2023-12-01 20:40:44 +01:00
e2da4f09ee Fixed command
All checks were successful
Deploy staging on push / on-push-deploy_sh-edraft (push) Successful in 4m50s
2023-12-01 20:02:42 +01:00
4ed99da689 Merge pull request 'dev' (#445) from dev into staging
All checks were successful
Deploy staging on push / on-push-deploy_sh-edraft (push) Successful in 3m32s
Reviewed-on: #445
2023-12-01 19:55:54 +01:00
5de6710261 Merge pull request 'staging' (#435) from staging into master
All checks were successful
Deploy prod on push / on-push-deploy_sh-edraft (push) Successful in 3m34s
Reviewed-on: #435
2023-11-07 20:37:13 +01:00
4 changed files with 13 additions and 36 deletions

View File

@@ -20,7 +20,7 @@ class ScheduledEventsCommand(DiscordCommandABC):
self._logger.trace(__name__, f"Loaded command service: {type(self).__name__}")
@commands.group(name="scheduled-events")
@commands.hybrid_group(name="scheduled-events")
@commands.guild_only()
async def scheduled_events(self, ctx: Context):
pass

View File

@@ -41,6 +41,6 @@ class BaseOnScheduledEventUpdateEvent(OnScheduledEventUpdateABC):
if event is None:
return
self._events.remove_event(event)
await self._events.check_and_create_scheduled_events(before.guild)
await self._events.check_and_create_scheduled_events(before.guild)
self._logger.debug(__name__, f"Module {type(self)} stopped")

View File

@@ -74,7 +74,8 @@ class EventService:
active_event.participants.append(user)
def _append_interval(self, interval: ScheduledEventIntervalEnum, ts: datetime) -> datetime:
if ts >= datetime.now():
now = datetime.now().replace(tzinfo=ZoneInfo("Europe/Berlin"))
if ts >= now:
return ts
if interval == ScheduledEventIntervalEnum.daily:
@@ -90,7 +91,7 @@ class EventService:
elif interval == ScheduledEventIntervalEnum.yearly:
ts = ts + timedelta(days=365)
while ts < datetime.now():
while ts < now:
ts = self._append_interval(interval, ts)
return ts
@@ -114,16 +115,18 @@ class EventService:
kwargs["channel"] = guild.get_channel(scheduled_event.channel_id)
if scheduled_event.start_time is not None:
scheduled_event.start_time = self._append_interval(scheduled_event.interval, scheduled_event.start_time)
start_time = scheduled_event.start_time.replace(tzinfo=ZoneInfo("Europe/Berlin"))
start_time = self._append_interval(
scheduled_event.interval, scheduled_event.start_time.replace(tzinfo=ZoneInfo("Europe/Berlin"))
)
kwargs["start_time"] = start_time
scheduled_event.start_time = scheduled_event.start_time.replace(tzinfo=None)
if scheduled_event.end_time is not None:
scheduled_event.end_time = self._append_interval(scheduled_event.interval, scheduled_event.end_time)
end_time = scheduled_event.end_time.replace(tzinfo=ZoneInfo("Europe/Berlin"))
end_time = self._append_interval(
scheduled_event.interval, scheduled_event.end_time.replace(tzinfo=ZoneInfo("Europe/Berlin"))
)
kwargs["end_time"] = end_time
scheduled_event.end_time = scheduled_event.end_time.replace(tzinfo=None)
kwargs["entity_type"] = scheduled_event.entity_type
if scheduled_event.location is not None:

View File

@@ -1,26 +0,0 @@
# -*- 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.thread"
__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")