Skip to content

Commit

Permalink
Fix unmuting when a mod isn't a mod anymore. (#6411)
Browse files Browse the repository at this point in the history
Co-authored-by: TrustyJAID <TrustyJAID@gmail.com>
Kowlin and TrustyJAID authored Aug 4, 2024
1 parent 7eb26da commit 2d47d75
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions redbot/cogs/mutes/mutes.py
Original file line number Diff line number Diff line change
@@ -329,7 +329,7 @@ async def _auto_unmute_user(self, guild: discord.Guild, data: dict):
del muted_users[str(data["member"])]
del self._server_mutes[guild.id][data["member"]]
return
result = await self.unmute_user(guild, author, member, _("Automatic unmute"))
result = await self.unmute_user(guild, None, member, _("Automatic unmute"))
async with self.config.guild(guild).muted_users() as muted_users:
if str(member.id) in muted_users:
del muted_users[str(member.id)]
@@ -507,7 +507,7 @@ async def _auto_channel_unmute_user(
del self._channel_mutes[channel.id][data["member"]]
return None
result = await self.channel_unmute_user(
channel.guild, channel, author, member, _("Automatic unmute")
channel.guild, channel, None, member, _("Automatic unmute")
)
async with self.config.channel(channel).muted_users() as muted_users:
if str(member.id) in muted_users:
@@ -1750,7 +1750,7 @@ async def mute_user(
async def unmute_user(
self,
guild: discord.Guild,
author: discord.Member,
author: Optional[discord.Member],
user: discord.Member,
reason: Optional[str] = None,
) -> MuteResponse:
@@ -1760,7 +1760,7 @@ async def unmute_user(
ret: MuteResponse = MuteResponse(success=False, reason=None, user=user)

mute_role_id = await self.config.guild(guild).mute_role()
if not await self.is_allowed_by_hierarchy(guild, author, user):
if author is not None and not await self.is_allowed_by_hierarchy(guild, author, user):
ret.reason = _(MUTE_UNMUTE_ISSUES["hierarchy_problem"])
return ret

@@ -1926,7 +1926,7 @@ async def channel_unmute_user(
self,
guild: discord.Guild,
channel: discord.abc.GuildChannel,
author: discord.Member,
author: Optional[discord.Member],
user: discord.Member,
reason: Optional[str] = None,
*,
@@ -1963,7 +1963,7 @@ async def channel_unmute_user(
if channel.permissions_for(guild.me).move_members:
move_channel = True

if not await self.is_allowed_by_hierarchy(guild, author, user):
if author is not None and not await self.is_allowed_by_hierarchy(guild, author, user):
ret.reason = _(MUTE_UNMUTE_ISSUES["hierarchy_problem"])
return ret

0 comments on commit 2d47d75

Please sign in to comment.