Skip to content

Conversation

@Jan200101
Copy link
Contributor

Closes #5161
Alternative of #5345

Description of the changes

catches discord.errors.HTTPException thrown by add_roles and remove_roles and states the user is already (un)muted

@github-actions github-actions bot added the Category: Cogs - Mutes This is related to the Mutes cog. label Dec 14, 2021
if guild.id in self._server_mutes:
if user.id in self._server_mutes[guild.id]:
del self._server_mutes[guild.id][user.id]
if guild.id in self._server_mutes and user.id in self._server_mutes[guild.id]:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if statement changed to match the one in mute_user

if not guild.me.guild_permissions.manage_roles or role >= guild.me.top_role:
ret["reason"] = _(MUTE_UNMUTE_ISSUES["permissions_issue_role"])
return ret
if role in user.roles:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As Jack stated in #5161 we should care more about [p]unmute not so much [p]mute. This would prevent updating a mute duration forcing the user to unmute and then re-apply the mute which is inconvenient.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you make a good point.

add_roles won't fail if the user already has the role and since the user is already muted the user gets what they expected.

It might be worthwhile to add a message for updating the mute duration and printing out already muted if none is given, but this is not the point of this PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is something along the lines of what I mean (keeping the already existing text)
image

@Jackenmen Jackenmen added this to the 3.4.x milestone Dec 23, 2021
@Jackenmen Jackenmen added Needs Backport To 3.4 Type: Enhancement Something meant to enhance existing Red features. labels Dec 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Category: Cogs - Mutes This is related to the Mutes cog. Type: Enhancement Something meant to enhance existing Red features.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mute command should check for the user's role list before muting/unmuting

4 participants