[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>
This commit is contained in:
Vexed 2020-07-12 17:44:34 +01:00 committed by GitHub
parent c4d295b25d
commit 1ee32b77dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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))