Skip to content

Commit

Permalink
ignore jump urls for voice channels
Browse files Browse the repository at this point in the history
  • Loading branch information
shtlrs committed Apr 22, 2023
1 parent 5585661 commit 57aabac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions bot/exts/filtering/filtering.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,12 @@ async def on_message_edit(self, before: discord.Message, after: discord.Message)
self._increment_stats(triggers)

@Cog.listener()
async def on_voice_state_update(self, member: discord.Member, *_) -> None:
async def on_voice_state_update(
self, member: discord.Member, before: discord.VoiceState, after: discord.VoiceState
) -> None:
"""Checks for bad words in usernames when users join, switch or leave a voice channel."""
ctx = FilterContext(Event.NICKNAME, member, None, member.display_name, None)
channel = before.channel or after.channel
ctx = FilterContext(Event.NICKNAME, member, channel, member.display_name, None)
await self._check_bad_name(ctx)

@Cog.listener()
Expand Down
4 changes: 2 additions & 2 deletions bot/exts/moderation/infraction/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from bot.errors import InvalidInfractedUserError
from bot.log import get_logger
from bot.utils import time
from bot.utils.channel import is_in_category
from bot.utils.channel import is_in_category, is_voice_channel
from bot.utils.time import unpack_duration

log = get_logger(__name__)
Expand Down Expand Up @@ -98,7 +98,7 @@ async def post_infraction(
if any(
is_in_category(ctx.channel, category)
for category in (Categories.modmail, Categories.appeals, Categories.appeals_2)
):
) or is_voice_channel(ctx.channel):
jump_url = None
else:
jump_url = ctx.message.jump_url
Expand Down

0 comments on commit 57aabac

Please sign in to comment.