Skip to content

Commit

Permalink
Merge pull request sopel-irc#610 from warddr/issue609-RemindToLower
Browse files Browse the repository at this point in the history
Make time units case insensitive
  • Loading branch information
embolalia committed Aug 31, 2014
2 parents 9bed424 + 7ed10e3 commit 4194534
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions remind.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,15 @@ def monitor(bot):
def remind(bot, trigger):
"""Gives you a reminder in the given amount of time."""
duration = 0
message = filter(None, re.split('(\d+(?:\.\d+)? ?(?:' + periods + ')) ?',
message = filter(None, re.split('(\d+(?:\.\d+)? ?(?:(?i)' + periods + ')) ?',
trigger.group(2))[1:])
reminder = ''
stop = False
for piece in message:
grp = re.match('(\d+(?:\.\d+)?) ?(.*) ?', piece)
if grp and not stop:
length = float(grp.group(1))
factor = scaling.get(grp.group(2), 60)
factor = scaling.get(grp.group(2).lower(), 60)
duration += length * factor
else:
reminder = reminder + piece
Expand Down

0 comments on commit 4194534

Please sign in to comment.