Skip to content

Commit

Permalink
[BoostUtils] add proper checks
Browse files Browse the repository at this point in the history
  • Loading branch information
japandotorg committed Mar 19, 2024
1 parent 86ae824 commit 598c237
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions boostutils/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ async def on_member_boost(self, member: discord.Member) -> None:
toggle: bool = await self.config.guild(guild).boost_message.toggle() # type: ignore
if not toggle:
return
if await self.bot.cog_disabled_in_guild(self, guild):
return
kwargs: Dict[str, Any] = process_tagscript(
message,
{
Expand All @@ -92,6 +94,8 @@ async def on_member_boost(self, member: discord.Member) -> None:
for channel_id in channels:
channel: discord.TextChannel = guild.get_channel(channel_id) # type: ignore
if channel:
if not channel.permissions_for(guild.me).send_messages:
return
await channel.send(**kwargs)

@commands.Cog.listener()
Expand All @@ -102,6 +106,8 @@ async def on_member_unboost(self, member: discord.Member) -> None:
toggle: bool = await self.config.guild(guild).boost_message.toggle() # type: ignore
if not toggle:
return
if await self.bot.cog_disabled_in_guild(self, guild):
return
kwargs: Dict[str, Any] = process_tagscript(
message,
{
Expand All @@ -121,4 +127,6 @@ async def on_member_unboost(self, member: discord.Member) -> None:
for channel_id in channels:
channel: discord.TextChannel = guild.get_channel(channel_id) # type: ignore
if channel:
if not channel.permissions_for(guild.me).send_messages:
return
await channel.send(**kwargs)

0 comments on commit 598c237

Please sign in to comment.