mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
Fix unmuting when a mod isn't a mod anymore. (#6411)
Co-authored-by: TrustyJAID <TrustyJAID@gmail.com>
This commit is contained in:
parent
7eb26da647
commit
2d47d75919
@ -329,7 +329,7 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
|
||||
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 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
|
||||
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 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
|
||||
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 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
|
||||
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 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
|
||||
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 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
|
||||
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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user