aboutsummaryrefslogtreecommitdiffstats
path: root/bot/seasons/valentines/myvalenstate.py
diff options
context:
space:
mode:
Diffstat (limited to 'bot/seasons/valentines/myvalenstate.py')
-rw-r--r--bot/seasons/valentines/myvalenstate.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/bot/seasons/valentines/myvalenstate.py b/bot/seasons/valentines/myvalenstate.py
index 344f52f6..0256c39a 100644
--- a/bot/seasons/valentines/myvalenstate.py
+++ b/bot/seasons/valentines/myvalenstate.py
@@ -11,19 +11,18 @@ from bot.constants import Colours
log = logging.getLogger(__name__)
-with open(Path('bot', 'resources', 'valentines', 'valenstates.json'), 'r') as file:
+with open(Path("bot/resources/valentines/valenstates.json"), "r") as file:
STATES = json.load(file)
class MyValenstate(commands.Cog):
"""A Cog to find your most likely Valentine's vacation destination."""
- def __init__(self, bot):
+ def __init__(self, bot: commands.Bot):
self.bot = bot
- def levenshtein(self, source, goal):
+ def levenshtein(self, source: str, goal: str) -> int:
"""Calculates the Levenshtein Distance between source and goal."""
-
if len(source) < len(goal):
return self.levenshtein(goal, source)
if len(source) == 0:
@@ -43,9 +42,8 @@ class MyValenstate(commands.Cog):
return pre_row[-1]
@commands.command()
- async def myvalenstate(self, ctx, *, name=None):
+ async def myvalenstate(self, ctx: commands.Context, *, name: str = None) -> None:
"""Find the vacation spot(s) with the most matching characters to the invoking user."""
-
eq_chars = collections.defaultdict(int)
if name is None:
author = ctx.message.author.name.lower().replace(' ', '')
@@ -83,8 +81,7 @@ class MyValenstate(commands.Cog):
await ctx.channel.send(embed=embed)
-def setup(bot):
+def setup(bot: commands.Bot) -> None:
"""Valenstate Cog load."""
-
bot.add_cog(MyValenstate(bot))
log.info("MyValenstate cog loaded")