diff options
author | 2025-01-02 18:59:28 +0000 | |
---|---|---|
committer | 2025-01-02 18:59:28 +0000 | |
commit | a99ad11f56ce26f219d6982b3c19857f34fc6e30 (patch) | |
tree | 4ae6a4f56ab2cd36c725fe361222dbbfb111c957 | |
parent | Bump sentry-sdk from 2.19.0 to 2.19.2 (#1639) (diff) |
Handle the case where get_top_posts returns an embed on error
-rw-r--r-- | bot/exts/utilities/reddit.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/bot/exts/utilities/reddit.py b/bot/exts/utilities/reddit.py index 085be42a..19c39476 100644 --- a/bot/exts/utilities/reddit.py +++ b/bot/exts/utilities/reddit.py @@ -301,6 +301,11 @@ class Reddit(Cog): async with ctx.typing(): pages = await self.get_top_posts(subreddit=subreddit, time="all", paginate=True) + if isinstance(pages, Embed): + # If get_top_posts hits an error, then an error embed is returned, not actual posts. + await ctx.send(embed=pages) + return + await ctx.send(f"Here are the top {subreddit} posts of all time!") embed = Embed( color=Colour.og_blurple() |