From 1ebff95e417bbbd8b50ea808946fa8d03c11d88c Mon Sep 17 00:00:00 2001 From: Nick80835 Date: Sat, 4 Apr 2020 10:03:40 -0400 Subject: [PATCH] fix issues with some subs and fix fallback --- ubot/modules/reddit.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ubot/modules/reddit.py b/ubot/modules/reddit.py index 04d8473..5cac823 100644 --- a/ubot/modules/reddit.py +++ b/ubot/modules/reddit.py @@ -43,7 +43,7 @@ async def bodyfetcherfallback(sub): shuffle(hot_list) for i in hot_list: - if i.selftext: + if i.selftext and not i.permalink in i.url: return i.selftext, i.title return None, None @@ -89,10 +89,11 @@ async def titlefetcher(event, sub): async def bodyfetcher(event, sub): for _ in range(10): post = REDDIT.subreddit(sub).random() + body = None if not post: - body, title = await titlefetcherfallback(sub) - elif post.selftext: + body, title = await bodyfetcherfallback(sub) + elif post.selftext and not post.permalink is post.url: body = post.selftext title = post.title