Handle types in parse_seconds().
authorCMDR furrycat <elite@furrycat.net>
Sun, 4 Dec 2016 11:25:53 +0000 (11:25 +0000)
committerCMDR furrycat <elite@furrycat.net>
Sun, 4 Dec 2016 11:25:53 +0000 (11:25 +0000)
The supplied argument might actually be an int.
The returned value must always be an int.

bot.py

diff --git a/bot.py b/bot.py
index e62367d..e3b8d79 100644 (file)
--- a/bot.py
+++ b/bot.py
@@ -59,10 +59,10 @@ def parse_boolean(string):
   return False
 
 def parse_seconds(formatted):
-  formatted = formatted.strip()
+  formatted = str(formatted).strip()
   m = re.match(r'(\d+)s?$', formatted)
   if m is not None:
-    return m.group(1)
+    return int(m.group(1))
   remaining = formatted
   seconds = 0
   while remaining: