diff options
| author | 2023-05-06 16:12:32 +0100 | |
|---|---|---|
| committer | 2023-05-09 15:41:50 +0100 | |
| commit | 613840ebcf303e84048d48ace37fb001c1afe687 (patch) | |
| tree | 9acaf0bae0527fe8389483a419b44e06997ca060 /bot/exts/events/hacktoberfest/timeleft.py | |
| parent | Migrate to ruff (diff) | |
Apply fixes for ruff linting
Co-authored-by: wookie184 <[email protected]>
Co-authored-by: Amrou Bellalouna <[email protected]>
Diffstat (limited to 'bot/exts/events/hacktoberfest/timeleft.py')
| -rw-r--r-- | bot/exts/events/hacktoberfest/timeleft.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/bot/exts/events/hacktoberfest/timeleft.py b/bot/exts/events/hacktoberfest/timeleft.py index f470e932..8f46d798 100644 --- a/bot/exts/events/hacktoberfest/timeleft.py +++ b/bot/exts/events/hacktoberfest/timeleft.py @@ -1,5 +1,5 @@ import logging -from datetime import datetime +from datetime import UTC, datetime from discord.ext import commands @@ -9,25 +9,25 @@ log = logging.getLogger(__name__) class TimeLeft(commands.Cog): - """A Cog that tells you how long left until Hacktober is over!""" + """A Cog that tells users how long left until Hacktober is over!""" def in_hacktober(self) -> bool: """Return True if the current time is within Hacktoberfest.""" _, end, start = self.load_date() - now = datetime.utcnow() + now = datetime.now(tz=UTC) return start <= now <= end @staticmethod def load_date() -> tuple[datetime, datetime, datetime]: - """Return of a tuple of the current time and the end and start times of the next October.""" - now = datetime.utcnow() + """Return of a tuple of the current time and the end and start times of the next Hacktober.""" + now = datetime.now(tz=UTC) year = now.year if now.month > 10: year += 1 - end = datetime(year, 11, 1, 12) # November 1st 12:00 (UTC-12:00) - start = datetime(year, 9, 30, 10) # September 30th 10:00 (UTC+14:00) + end = datetime(year, 11, 1, 12, tzinfo=UTC) # November 1st 12:00 (UTC-12:00) + start = datetime(year, 9, 30, 10, tzinfo=UTC) # September 30th 10:00 (UTC+14:00) return now, end, start @commands.command() |