mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-07 19:58:54 -05:00
[Streams] Remove the blank suppression of errors (#4680)
* [Streams] Remove the blank suppression of errors * Okay, maybe do gracefully handle it a little bit... * Update redbot/cogs/streams/streams.py Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
parent
d01bca2314
commit
8ae84b7c81
@ -725,13 +725,15 @@ class Streams(commands.Cog):
|
|||||||
|
|
||||||
async def check_streams(self):
|
async def check_streams(self):
|
||||||
for stream in self.streams:
|
for stream in self.streams:
|
||||||
with contextlib.suppress(Exception):
|
try:
|
||||||
try:
|
try:
|
||||||
if stream.__class__.__name__ == "TwitchStream":
|
if stream.__class__.__name__ == "TwitchStream":
|
||||||
await self.maybe_renew_twitch_bearer_token()
|
await self.maybe_renew_twitch_bearer_token()
|
||||||
embed, is_rerun = await stream.is_online()
|
embed, is_rerun = await stream.is_online()
|
||||||
|
|
||||||
elif stream.__class__.__name__ == "YoutubeStream":
|
elif stream.__class__.__name__ == "YoutubeStream":
|
||||||
embed, is_schedule = await stream.is_online()
|
embed, is_schedule = await stream.is_online()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
embed = await stream.is_online()
|
embed = await stream.is_online()
|
||||||
is_rerun = False
|
is_rerun = False
|
||||||
@ -740,11 +742,11 @@ class Streams(commands.Cog):
|
|||||||
if not stream._messages_cache:
|
if not stream._messages_cache:
|
||||||
continue
|
continue
|
||||||
for message in stream._messages_cache:
|
for message in stream._messages_cache:
|
||||||
with contextlib.suppress(Exception):
|
|
||||||
if await self.bot.cog_disabled_in_guild(self, message.guild):
|
if await self.bot.cog_disabled_in_guild(self, message.guild):
|
||||||
continue
|
continue
|
||||||
autodelete = await self.config.guild(message.guild).autodelete()
|
autodelete = await self.config.guild(message.guild).autodelete()
|
||||||
if autodelete:
|
if autodelete:
|
||||||
|
with contextlib.suppress(discord.NotFound):
|
||||||
await message.delete()
|
await message.delete()
|
||||||
stream._messages_cache.clear()
|
stream._messages_cache.clear()
|
||||||
await self.save_streams()
|
await self.save_streams()
|
||||||
@ -813,6 +815,8 @@ class Streams(commands.Cog):
|
|||||||
for role in edited_roles:
|
for role in edited_roles:
|
||||||
await role.edit(mentionable=False)
|
await role.edit(mentionable=False)
|
||||||
await self.save_streams()
|
await self.save_streams()
|
||||||
|
except Exception as e:
|
||||||
|
log.error("An error has occured with Streams. Please report it.", exc_info=e)
|
||||||
|
|
||||||
async def _get_mention_str(
|
async def _get_mention_str(
|
||||||
self, guild: discord.Guild, channel: discord.TextChannel
|
self, guild: discord.Guild, channel: discord.TextChannel
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user