2
0
mirror of https://github.com/Nick80835/microbot synced 2025-08-22 10:09:40 +00:00

fix issues with some subs and fix fallback

This commit is contained in:
Nick80835 2020-04-04 10:03:40 -04:00
parent 7799a9e789
commit 1ebff95e41

View File

@ -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