From bf206bfd5ffc677903b540cdbb8f6f77e4d0c18f Mon Sep 17 00:00:00 2001 From: sgoudham Date: Mon, 17 Aug 2020 19:59:48 +0100 Subject: [PATCH] Not checking permissions everytime the channel is muted and making muted role now disable read perms --- cogs/moderation.py | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/cogs/moderation.py b/cogs/moderation.py index b8ee6e06..a010fdf9 100644 --- a/cogs/moderation.py +++ b/cogs/moderation.py @@ -297,32 +297,11 @@ class Moderation(Cog): if role is None: muted = await ctx.guild.create_role(name="Muted") for channel in ctx.guild.channels: - await channel.set_permissions(muted, read_messages=True, send_messages=False, - read_message_history=False) + await channel.set_permissions(muted, read_messages=False) await mute_members(self, ctx, members, reason, muted) - - # Make sure that the Muted Role has the correct permissions before muting member(s) + else: - for channel in ctx.guild.channels: - perms = channel.overwrites_for(role) - - # Set the read_messages to True, only when the read_messages is False or None - if not perms.read_messages or perms.read_messages is None: - perms.read_messages = True - - # Set the send_messages to True, only when the send_messages is False or None - if perms.send_messages or perms.send_messages is None: - perms.send_messages = False - - # Set the read_message_history to True, only when the read_message_history is False or None - if perms.read_message_history or perms.read_message_history is None: - perms.read_message_history = False - - # Overwrite the permissions if any perms were changed - if perms.read_messages or perms.send_messages or perms.read_message_history: - await channel.set_permissions(role, overwrite=perms) - await mute_members(self, ctx, members, reason, role) @command(name="unmute", usage="`...` `[reason]`")