From: CMDR furrycat Date: Sun, 4 Dec 2016 11:25:53 +0000 (+0000) Subject: Handle types in parse_seconds(). X-Git-Url: http://git.furryclan.net/?a=commitdiff_plain;h=a870c14ec3f9e01c5c6f8d0bbb405bb9c0ee7208;p=furrycat%2Fcatbot.git Handle types in parse_seconds(). The supplied argument might actually be an int. The returned value must always be an int. --- diff --git a/bot.py b/bot.py index e62367d..e3b8d79 100644 --- 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: