Added NSFW alert to reddit.py

\
This commit is contained in:
Luke Rogers 2013-10-01 03:10:19 +13:00
parent 9b92d73f3a
commit a45d470363

View file

@ -63,6 +63,11 @@ def reddit(inp):
rawtime = datetime.fromtimestamp(int(item["created_utc"]))
item["timesince"] = timesince.timesince(rawtime)
if item["over_18"]:
item["warning"] = " \x02NSFW\x02"
else:
item["warning"] = ""
return u'\x02{title}\x02 - posted by \x02{author}\x02' \
' {timesince} ago - {ups} upvotes, {downs} downvotes -' \
' {link}'.format(**item)
' {link}{warning}'.format(**item)