Skip to content

Commit

Permalink
Prevent note edits from being DMed to users on change
Browse files Browse the repository at this point in the history
  • Loading branch information
MattBSG committed Jan 26, 2025
1 parent 123e2c4 commit b8888ee
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions modules/moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,25 +281,26 @@ async def _infraction_editing(
logging.error(f'[Moderation] _infraction_duration: {e}')

error = ''
try:
member = await interaction.guild.fetch_member(doc['user'])
if duration:
await member.send(tools.format_pundm('duration-update', reason, details=(doc['type'], expireStr)))
if doc['type'] != 'note':
try:
member = await interaction.guild.fetch_member(doc['user'])
if duration:
await member.send(tools.format_pundm('duration-update', reason, details=(doc['type'], expireStr)))

else:
await member.send(
tools.format_pundm(
'reason-update',
reason,
details=(
doc['type'],
f'<t:{int(doc["timestamp"])}:f>',
),
else:
await member.send(
tools.format_pundm(
'reason-update',
reason,
details=(
doc['type'],
f'<t:{int(doc["timestamp"])}:f>',
),
)
)
)

except (discord.NotFound, discord.Forbidden, AttributeError):
error = '. I was not able to DM them about this action'
except (discord.NotFound, discord.Forbidden, AttributeError):
error = '. I was not able to DM them about this action'

await interaction.followup.send(
f'{config.greenTick} The {doc["type"]} {"duration" if duration else "reason"} has been successfully updated for {user} ({user.id}){error}',
Expand Down

0 comments on commit b8888ee

Please sign in to comment.