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.
This commit is contained in:
Niclas Eriksen 2015-10-15 12:13:34 +02:00
parent 4e8dd82792
commit f696cb5989

View File

@ -28,6 +28,8 @@ class Reddit(IntervalModule):
* {message_author} * {message_author}
* {message_subject} * {message_subject}
* {message_body} * {message_body}
* {link_karma}
* {comment_karma}
""" """
@ -131,6 +133,14 @@ class Reddit(IntervalModule):
title = fdict["submission_title"][:(self.title_maxlen - 3)] + "..." title = fdict["submission_title"][:(self.title_maxlen - 3)] + "..."
fdict["submission_title"] = title 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) full_text = self.format.format(**fdict)
self.output = { self.output = {
"full_text": full_text, "full_text": full_text,