Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions sopel/modules/reddit.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,14 @@ def say_post_info(bot, trigger, id_, show_link=True, show_comments_link=False):
s = bot.memory['reddit_praw'].submission(id=id_)

message = (
'{title} {link}{nsfw} | {points} {points_text} ({percent}) | '
'{comments} {comments_text} | Posted by {author} | '
'{title}{flair} {link}{nsfw} | {points} {points_text} ({percent}) '
'| {comments} {comments_text} | Posted by {author} | '
'Created at {created}{comments_link}')

flair = ''
if s.link_flair_text:
flair = " ('{}' flair)".format(s.link_flair_text)

subreddit = s.subreddit.display_name
if not show_link:
link = 'to r/{}'.format(subreddit)
Expand Down Expand Up @@ -205,9 +209,10 @@ def say_post_info(bot, trigger, id_, show_link=True, show_comments_link=False):

title = html.unescape(s.title)
message = message.format(
title=title, link=link, nsfw=nsfw, points=s.score, points_text=points_text,
percent=percent, comments=s.num_comments, comments_text=comments_text,
author=author, created=created, comments_link=comments_link)
title=title, flair=flair, link=link, nsfw=nsfw, points=s.score,
points_text=points_text, percent=percent, comments=s.num_comments,
comments_text=comments_text, author=author, created=created,
comments_link=comments_link)

bot.say(message)
except prawcore.exceptions.NotFound:
Expand Down