diff options
author | 2021-07-12 16:49:46 +0530 | |
---|---|---|
committer | 2021-07-12 16:49:46 +0530 | |
commit | 7e3b7cae852fcb8d2a13d648fd06ea74d863981e (patch) | |
tree | bddc6d58ec93bd9f4553d0a75fa4dbf5ebfe8576 | |
parent | (modpings): Make flake8 happy! (diff) |
Fix bugs when scheduling from cache
1. Dict was missing .items() method, causing TypeError.
2. Timestamp wasn't converted to float before passing to dt.fromtimestamp(), was stored as a joined string with work_time.
-rw-r--r-- | bot/exts/moderation/modpings.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bot/exts/moderation/modpings.py b/bot/exts/moderation/modpings.py index cf45a2182..1f6b7984a 100644 --- a/bot/exts/moderation/modpings.py +++ b/bot/exts/moderation/modpings.py @@ -71,9 +71,9 @@ class ModPings(Cog): schedule_cache = await self.modpings_schedule.to_dict() log.info("Scheduling modpings schedule for applicable moderators found in cache.") - for mod_id, schedule in schedule_cache: + for mod_id, schedule in schedule_cache.items(): start_timestamp, work_time = schedule.split("|") - start = datetime.datetime.fromtimestamp(start_timestamp) + start = datetime.datetime.fromtimestamp(float(start_timestamp)) mod = self.bot.fetch_user(mod_id) self._modpings_scheduler.schedule_at( |