bot icon indicating copy to clipboard operation
bot copied to clipboard

Account for users that leave the guild before an infraction can be applied or pardoned

Open MarkKoz opened this issue 5 years ago • 2 comments

Sentry Issues: BOT-6S BOT-6G

In the case below, I believe they left the guild after the muted role was added but before it could attempt to kick them from a voice channel.

NotFound: 404 Not Found (error code: 10007): Unknown Member
  File "bot/cogs/moderation/scheduler.py", line 155, in apply_infraction
    await action_coro
  File "bot/cogs/moderation/infractions.py", line 229, in action
    await user.move_to(None, reason=reason)
  File "discord/member.py", line 603, in move_to
    await self.edit(voice_channel=channel, reason=reason)
  File "discord/member.py", line 578, in edit
    await http.edit_member(guild_id, self.id, reason=reason, **payload)
  File "discord/http.py", line 223, in request
    raise NotFound(r, data)

Failed to apply mute infraction #<REDACTED> to <REDACTED>

The infraction should be retained so that it is reapplied if the user returns to the guild. With that in mind, this error is pretty harmless so it could be silently ignored. I believe user leave events are already being logged separately. However, perhaps staff may find it useful to know a user left anyway as part of the infraction mod log and confirmation.

MarkKoz avatar Jul 09 '20 07:07 MarkKoz

Didn't realise this is a partial duplicate of #1006. This issue can focus on pardons then.

MarkKoz avatar Jul 13 '20 00:07 MarkKoz

Since this is related to #1251 I can deal with it at the same time.

mbaruh avatar Oct 22 '20 02:10 mbaruh