From f696cb5989399087a4046b7ee6afac0ea9bc855f Mon Sep 17 00:00:00 2001 From: Niclas Eriksen Date: Thu, 15 Oct 2015 12:13:34 +0200 Subject: [PATCH] Can now fetch link and comment karma of user Link and comment karma of user can be fetched with {link_karma} and {comment_karma} if username is set. --- i3pystatus/reddit.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/i3pystatus/reddit.py b/i3pystatus/reddit.py index 3535fbd..b2889af 100644 --- a/i3pystatus/reddit.py +++ b/i3pystatus/reddit.py @@ -28,6 +28,8 @@ class Reddit(IntervalModule): * {message_author} * {message_subject} * {message_body} + * {link_karma} + * {comment_karma} """ @@ -131,6 +133,14 @@ class Reddit(IntervalModule): title = fdict["submission_title"][:(self.title_maxlen - 3)] + "..." fdict["submission_title"] = title + if self.username: + u = r.get_redditor(self.username) + fdict["link_karma"] = u.link_karma + fdict["comment_karma"] = u.comment_karma + else: + fdict["link_karma"] = "" + fdict["comment_karma"] = "" + full_text = self.format.format(**fdict) self.output = { "full_text": full_text,