ソースを参照

Improve !remind time detection (allow e.g. "!remind 7d-2h")

tags/v0.3
Ben Kurtovic 9年前
コミット
ac678c0f14
2個のファイルの変更4行の追加6行の削除
  1. +1
    -1
      CHANGELOG
  2. +3
    -5
      earwigbot/commands/remind.py

+ 1
- 1
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.



+ 3
- 5
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:


読み込み中…
キャンセル
保存