diff options
| author | 2019-03-30 10:37:59 -0400 | |
|---|---|---|
| committer | 2019-03-30 10:37:59 -0400 | |
| commit | 5fe5b7c688e19e533fe34d98b8c754bc67a58beb (patch) | |
| tree | 16c2946f97f85facf6b994b3c48099d369ee7f5a /bot/seasons/valentines/myvalenstate.py | |
| parent | Merge pull request #163 from python-discord/easter_announce (diff) | |
| parent | Blank line required between summary line and description. (diff) | |
Merge pull request #146 from python-discord/flake8-docstring
Implement flake8-docstrings
Diffstat (limited to 'bot/seasons/valentines/myvalenstate.py')
| -rw-r--r-- | bot/seasons/valentines/myvalenstate.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/bot/seasons/valentines/myvalenstate.py b/bot/seasons/valentines/myvalenstate.py index 7d9f3a59..0ea8fbab 100644 --- a/bot/seasons/valentines/myvalenstate.py +++ b/bot/seasons/valentines/myvalenstate.py @@ -15,14 +15,15 @@ with open(Path('bot', 'resources', 'valentines', 'valenstates.json'), 'r') as fi STATES = json.load(file) -class MyValenstate(commands.Cog): +class MyValenstate: + """A Cog to find your most likely Valentine's vacation destination.""" + def __init__(self, bot): self.bot = bot def levenshtein(self, source, goal): - """ - Calculates the Levenshtein Distance between source and goal. - """ + """Calculates the Levenshtein Distance between source and goal.""" + if len(source) < len(goal): return self.levenshtein(goal, source) if len(source) == 0: @@ -43,6 +44,8 @@ class MyValenstate(commands.Cog): @commands.command() async def myvalenstate(self, ctx, *, name=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(' ', '') @@ -81,5 +84,7 @@ class MyValenstate(commands.Cog): def setup(bot): + """Valenstate Cog load.""" + bot.add_cog(MyValenstate(bot)) log.info("MyValenstate cog loaded") |