mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-21 02:16:09 -05:00
Handle when users leave a server while we're applying mutes
Goddamn guilds with >100 text channels >.<
This commit is contained in:
@@ -22,6 +22,7 @@ mute_unmute_issues = {
|
||||
"permission and the user I'm muting must be "
|
||||
"lower than myself in the role hierarchy."
|
||||
),
|
||||
"left_guild": _("The user has left the server while we're applying a overwrite.")
|
||||
}
|
||||
_ = T_
|
||||
|
||||
@@ -422,6 +423,8 @@ class MuteMixin(MixinMeta):
|
||||
await channel.set_permissions(user, overwrite=overwrites, reason=reason)
|
||||
except discord.Forbidden:
|
||||
return False, _(mute_unmute_issues["permissions_issue"])
|
||||
except discord.NotFound:
|
||||
return False, _(mute_unmute_issues["left_guild"])
|
||||
else:
|
||||
await self.settings.member(user).set_raw(
|
||||
"perms_cache", str(channel.id), value=old_overs
|
||||
@@ -460,6 +463,8 @@ class MuteMixin(MixinMeta):
|
||||
await channel.set_permissions(user, overwrite=overwrites, reason=reason)
|
||||
except discord.Forbidden:
|
||||
return False, _(mute_unmute_issues["permissions_issue"])
|
||||
except discord.NotFound:
|
||||
return False, _(mute_unmute_issues["left_guild"])
|
||||
else:
|
||||
await self.settings.member(user).clear_raw("perms_cache", str(channel.id))
|
||||
return True, None
|
||||
|
||||
Reference in New Issue
Block a user