Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unmuting when a mod isn't a mod anymore. #6411

Merged
merged 3 commits into from
Aug 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions redbot/cogs/mutes/mutes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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

Expand Down Expand Up @@ -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,
*,
Expand Down Expand Up @@ -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

Expand Down
Loading