From 890b385c03f0e92815e4dd81a09fd75bc7b3e8f2 Mon Sep 17 00:00:00 2001 From: moneromooo Date: Fri, 13 Mar 2015 20:12:25 +0000 Subject: [PATCH] reddit: ignore posts from an author with no name --- tipbot/modules/reddit.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tipbot/modules/reddit.py b/tipbot/modules/reddit.py index 4ad0728..41e4b9f 100644 --- a/tipbot/modules/reddit.py +++ b/tipbot/modules/reddit.py @@ -105,6 +105,14 @@ class RedditNetwork(Network): def _parse(self,item,is_pm): if not hasattr(item,'author'): return + if not hasattr(item.author,'name'): + log_warn('author of %s has no name field, ignored' % str(item.id)) + try: + item.mark_as_read() + except Exception,e: + log_warning('Failed to mark %s as read: %s' % (item.id,str(e))) + return + author=self.canonicalize(item.author.name) if author==self.canonicalize(self.login): return