From 903a587209573ca927f28701f85c84a70761f798 Mon Sep 17 00:00:00 2001 From: moneromooo Date: Tue, 28 Jul 2015 18:43:57 +0100 Subject: [PATCH] reddit: fix parsing of tips-as-replies "+" was treated a valid number, since all parts were optional --- tipbot/modules/reddit.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tipbot/modules/reddit.py b/tipbot/modules/reddit.py index bdd607e..3078e1e 100644 --- a/tipbot/modules/reddit.py +++ b/tipbot/modules/reddit.py @@ -161,9 +161,10 @@ class RedditNetwork(Network): author=parent_item.author.name match=re.search("\+[0-9]*(\.[0-9]*)?",line) amount=match.group(0) - synthetic_cmd=['tip',author,amount.replace('+','')] - log_log('Running synthetic command: %s' % (str(synthetic_cmd))) - self.on_command(link,synthetic_cmd) + if amount!='+': + synthetic_cmd=['tip',author,amount.replace('+','')] + log_log('Running synthetic command: %s' % (str(synthetic_cmd))) + self.on_command(link,synthetic_cmd) except Exception,e: log_error('Failed to tip %s\'s parent: %s' % (item.id,str(e))) try: