2
0
mirror of https://github.com/Nick80835/microbot synced 2025-08-30 05:58:23 +00:00

make redt error less on empty subs

This commit is contained in:
Nick80835 2020-11-28 10:05:30 -05:00
parent f8b28157be
commit eb71d6b688

View File

@ -67,12 +67,16 @@ async def titlefetcher(event, sub):
try:
post = await subreddit.random() or await titlefetcherfallback(subreddit)
post.title
except redex.Forbidden:
await event.reply(f"**r/{sub}** is private!")
return
except (redex.NotFound, KeyError):
await event.reply(f"**r/{sub}** doesn't exist!")
return
except AttributeError:
await event.reply(f"Failed to find any valid content on **r/{sub}**!")
return
await event.reply(post.title)