mirror of
https://github.com/Nick80835/microbot
synced 2025-08-23 02:28:31 +00:00
fix issues with some subs and fix fallback
This commit is contained in:
parent
7799a9e789
commit
1ebff95e41
@ -43,7 +43,7 @@ async def bodyfetcherfallback(sub):
|
|||||||
shuffle(hot_list)
|
shuffle(hot_list)
|
||||||
|
|
||||||
for i in 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 i.selftext, i.title
|
||||||
|
|
||||||
return None, None
|
return None, None
|
||||||
@ -89,10 +89,11 @@ async def titlefetcher(event, sub):
|
|||||||
async def bodyfetcher(event, sub):
|
async def bodyfetcher(event, sub):
|
||||||
for _ in range(10):
|
for _ in range(10):
|
||||||
post = REDDIT.subreddit(sub).random()
|
post = REDDIT.subreddit(sub).random()
|
||||||
|
body = None
|
||||||
|
|
||||||
if not post:
|
if not post:
|
||||||
body, title = await titlefetcherfallback(sub)
|
body, title = await bodyfetcherfallback(sub)
|
||||||
elif post.selftext:
|
elif post.selftext and not post.permalink is post.url:
|
||||||
body = post.selftext
|
body = post.selftext
|
||||||
title = post.title
|
title = post.title
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user