mirror of
https://github.com/Nick80835/microbot
synced 2025-08-31 14:38:04 +00:00
make redt error less on empty subs
This commit is contained in:
@@ -67,12 +67,16 @@ async def titlefetcher(event, sub):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
post = await subreddit.random() or await titlefetcherfallback(subreddit)
|
post = await subreddit.random() or await titlefetcherfallback(subreddit)
|
||||||
|
post.title
|
||||||
except redex.Forbidden:
|
except redex.Forbidden:
|
||||||
await event.reply(f"**r/{sub}** is private!")
|
await event.reply(f"**r/{sub}** is private!")
|
||||||
return
|
return
|
||||||
except (redex.NotFound, KeyError):
|
except (redex.NotFound, KeyError):
|
||||||
await event.reply(f"**r/{sub}** doesn't exist!")
|
await event.reply(f"**r/{sub}** doesn't exist!")
|
||||||
return
|
return
|
||||||
|
except AttributeError:
|
||||||
|
await event.reply(f"Failed to find any valid content on **r/{sub}**!")
|
||||||
|
return
|
||||||
|
|
||||||
await event.reply(post.title)
|
await event.reply(post.title)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user