Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions redbot/cogs/streams/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,10 @@ async def _send_stream_alert(
message_data["is_schedule"] = True
stream.messages.append(message_data)

def _has_stream_alert_perms(self, channel: discord.TextChannel) -> bool:
perms = channel.permissions_for(channel.guild.me)
return all((perms.send_messages, perms.embed_links))

async def check_streams(self):
to_remove = []
for stream in self.streams:
Expand Down Expand Up @@ -888,6 +892,8 @@ async def check_streams(self):
if guild_data["ignore_schedule"] and is_schedule:
continue
if is_schedule:
if not self._has_stream_alert_perms(channel):
continue
# skip messages and mentions
await self._send_stream_alert(stream, channel, embed, is_schedule=True)
await self.save_streams()
Expand Down Expand Up @@ -938,11 +944,13 @@ async def check_streams(self):
formatting=True,
)
)
await self._send_stream_alert(stream, channel, embed, content)
if edited_roles:
for role in edited_roles:
await role.edit(mentionable=False)
await self.save_streams()

if self._has_stream_alert_perms(channel):
await self._send_stream_alert(stream, channel, embed, content)
if edited_roles:
for role in edited_roles:
await role.edit(mentionable=False)
await self.save_streams()
except Exception as e:
log.error("An error has occurred with Streams. Please report it.", exc_info=e)

Expand Down
Loading