Enabled read messages for muted role

Disabled read message history and send messages
Checking with every channel if the muted role has the permissions. If not, it overwrites with the permissions required
pull/8/head
sgoudham 4 years ago
parent 3b605a92fe
commit 46d6ad3474

@ -298,7 +298,8 @@ class Moderation(Cog):
if role is None: if role is None:
muted = await ctx.guild.create_role(name="Muted") muted = await ctx.guild.create_role(name="Muted")
for channel in ctx.guild.channels: for channel in ctx.guild.channels:
await channel.set_permissions(muted, read_messages=False) await channel.set_permissions(muted, read_messages=True, send_messages=False,
read_message_history=False)
await mute_members(self.bot.db, ctx, members, reason, muted) await mute_members(self.bot.db, ctx, members, reason, muted)
@ -307,8 +308,13 @@ class Moderation(Cog):
for channel in ctx.guild.channels: for channel in ctx.guild.channels:
perms = channel.overwrites_for(role) perms = channel.overwrites_for(role)
if perms.read_messages: if not perms.read_messages:
perms.read_messages = False perms.read_messages = True
elif perms.send_messages:
perms.send_messages = False
elif perms.read_message_history:
perms.read_message_history = False
await channel.set_permissions(role, overwrite=perms) await channel.set_permissions(role, overwrite=perms)
print(channel.name + "has been muted!") print(channel.name + "has been muted!")

Loading…
Cancel
Save