From 1ee32b77ddfd410873a25242539f9f7731938f5f Mon Sep 17 00:00:00 2001 From: Vexed Date: Sun, 12 Jul 2020 17:44:34 +0100 Subject: [PATCH] [Mod] `[p]mute|unmute voice` now take action instantly (#4064) * make mute and unmute have the same fail string * now add the jucy bits * hmm no This reverts commit a445bd84150585b4ad85c0c1ccadbee2022af196. * Apply suggestions from code review Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com> Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com> --- redbot/cogs/mod/mutes.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/redbot/cogs/mod/mutes.py b/redbot/cogs/mod/mutes.py index db76a0e5b..8b672cce8 100644 --- a/redbot/cogs/mod/mutes.py +++ b/redbot/cogs/mod/mutes.py @@ -207,6 +207,17 @@ class MuteMixin(MixinMeta): await ctx.send( _("Muted {user} in channel {channel.name}").format(user=user, channel=channel) ) + try: + if channel.permissions_for(ctx.me).move_members: + await user.move_to(channel) + else: + raise RuntimeError + except (discord.Forbidden, RuntimeError): + await ctx.send( + _( + "Because I don't have the Move Members permission, this will take into effect when the user rejoins." + ) + ) else: await ctx.send(issue) @@ -322,6 +333,17 @@ class MuteMixin(MixinMeta): await ctx.send( _("Unmuted {user} in channel {channel.name}").format(user=user, channel=channel) ) + try: + if channel.permissions_for(ctx.me).move_members: + await user.move_to(channel) + else: + raise RuntimeError + except (discord.Forbidden, RuntimeError): + await ctx.send( + _( + "Because I don't have the Move Members permission, this will take into effect when the user rejoins." + ) + ) else: await ctx.send(_("Unmute failed. Reason: {}").format(message))