aboutsummaryrefslogtreecommitdiffstats
path: root/bot/seasons/halloween/timeleft.py
diff options
context:
space:
mode:
Diffstat (limited to 'bot/seasons/halloween/timeleft.py')
-rw-r--r--bot/seasons/halloween/timeleft.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/bot/seasons/halloween/timeleft.py b/bot/seasons/halloween/timeleft.py
index 3ea2d9ad..77767baa 100644
--- a/bot/seasons/halloween/timeleft.py
+++ b/bot/seasons/halloween/timeleft.py
@@ -1,5 +1,6 @@
import logging
from datetime import datetime
+from typing import Tuple
from discord.ext import commands
@@ -9,19 +10,17 @@ log = logging.getLogger(__name__)
class TimeLeft(commands.Cog):
"""A Cog that tells you how long left until Hacktober is over!"""
- def __init__(self, bot):
+ def __init__(self, bot: commands.Bot):
self.bot = bot
@staticmethod
- def in_october():
+ def in_october() -> bool:
"""Return True if the current month is October."""
-
return datetime.utcnow().month == 10
@staticmethod
- def load_date():
+ def load_date() -> Tuple[int, datetime, datetime]:
"""Return of a tuple of the current time and the end and start times of the next October."""
-
now = datetime.utcnow()
year = now.year
if now.month > 10:
@@ -31,14 +30,13 @@ class TimeLeft(commands.Cog):
return now, end, start
@commands.command()
- async def timeleft(self, ctx):
+ async def timeleft(self, ctx: commands.Context) -> None:
"""
Calculates the time left until the end of Hacktober.
Whilst in October, displays the days, hours and minutes left.
Only displays the days left until the beginning and end whilst in a different month
"""
-
now, end, start = self.load_date()
diff = end - now
days, seconds = diff.days, diff.seconds
@@ -56,8 +54,7 @@ class TimeLeft(commands.Cog):
)
-def setup(bot):
+def setup(bot: commands.Bot) -> None:
"""Cog load."""
-
bot.add_cog(TimeLeft(bot))
log.info("TimeLeft cog loaded")