diff --git a/CHANGELOG b/CHANGELOG index 8c1dac9..0e3787f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,7 @@ v0.3 (unreleased): - Copyvio detector: improved sentence splitting algorithm. -- IRC: Added !remind all. +- IRC > !remind: Added !remind all. Improved time detection. - IRC: Improved detection of maximum IRC message length. - IRC: Improved some help commands. diff --git a/earwigbot/commands/remind.py b/earwigbot/commands/remind.py index 9422e86..a8c568f 100644 --- a/earwigbot/commands/remind.py +++ b/earwigbot/commands/remind.py @@ -78,13 +78,11 @@ class Remind(Command): else: raise ValueError(node) - if arg and arg[-1] in time_units: - factor, arg = time_units[arg[-1]], arg[:-1] - else: - factor = 1 + for unit, factor in time_units.iteritems(): + arg = arg.replace(unit, "*" + str(factor)) try: - parsed = int(_evaluate(ast.parse(arg, mode="eval").body) * factor) + parsed = int(_evaluate(ast.parse(arg, mode="eval").body)) except (SyntaxError, KeyError): raise ValueError(arg) if parsed <= 0: