Skip to content

Commit

Permalink
[BoostUtils] check before processing and account for system being dis…
Browse files Browse the repository at this point in the history
…abled
  • Loading branch information
japandotorg committed Aug 26, 2024
1 parent 5ad8bd1 commit 69f3b92
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions boostutils/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ async def on_message(self, message: discord.Message) -> None:
message.guild.system_channel
and not message.guild.system_channel.permissions_for(message.guild.me).view_channel
):
self.SYSTEM_ENABLED: bool = False
return
if message.guild.system_channel_flags.premium_subscriptions and message.type in (
discord.MessageType.premium_guild_subscription,
Expand Down Expand Up @@ -72,6 +73,8 @@ async def on_member_update(self, before: discord.Member, after: discord.Member)
async def on_member_boost(
self, member: discord.Member, type: Literal["system", "premium_subscriber_role"]
) -> None:
if self.SYSTEM_ENABLED and type.lower() == "premium_subscriber_role":
return
guild: discord.Guild = member.guild
channels: List[int] = await self.config.guild(guild).boost_message.channels()
message: str = await self.config.guild(guild).boost_message.boosted()
Expand Down Expand Up @@ -101,8 +104,6 @@ async def on_member_boost(
if channel:
if not channel.permissions_for(guild.me).send_messages:
return
if self.SYSTEM_ENABLED and type.lower() == "premium_subscriber_role":
return
await channel.send(**kwargs)

@commands.Cog.listener()
Expand Down

0 comments on commit 69f3b92

Please sign in to comment.