Catch reddit redirect errors

This commit is contained in:
Zeva Rose 2022-04-20 13:33:07 -06:00
parent 6f837d9ad3
commit 339c103fce

View file

@ -3,7 +3,7 @@ import asyncio
import logging
from asyncpraw import Reddit
from asyncprawcore.exceptions import Forbidden, NotFound
from asyncprawcore.exceptions import Forbidden, NotFound, Redirect
from dis_snek import InteractionContext, Permissions, Scale, Snake
from dis_snek.client.utils.misc_utils import get
from dis_snek.models.discord.channel import ChannelTypes, GuildText
@ -64,7 +64,7 @@ class RedditCog(Scale):
try:
subreddit = await self.api.subreddit(name)
await subreddit.load()
except (NotFound, Forbidden) as e:
except (NotFound, Forbidden, Redirect) as e:
self.logger.debug(f"Subreddit {name} raised {e.__class__.__name__} on add")
await ctx.send("Subreddit may be private, quarantined, or nonexistent.", ephemeral=True)
return