lockdown: https://elixi.re/i/ohha7362.mp4 (fixes overrides - hopefully)

This commit is contained in:
Ave Ozkal 2019-02-21 01:14:15 +03:00
parent e66a178b11
commit f2e210b9e3
No known key found for this signature in database
GPG key ID: 09356ABAA42C842B

View file

@ -11,8 +11,11 @@ class Lockdown:
async def unlock_for_staff(self, channel: discord.TextChannel, issuer): async def unlock_for_staff(self, channel: discord.TextChannel, issuer):
for role in config.staff_role_ids: for role in config.staff_role_ids:
try: try:
await channel.set_permissions(channel.guild.get_role(role), roleobj = channel.guild.get_role(role)
send_messages=True, overrides = channel.overwrites_for(roleobj)
overrides.send_messages = True
await channel.set_permissions(roleobj,
overwrite=overrides,
reason=str(issuer)) reason=str(issuer))
except: except:
pass pass
@ -36,8 +39,11 @@ class Lockdown:
roles = [config.named_roles["participant"]] roles = [config.named_roles["participant"]]
for role in roles: for role in roles:
await channel.set_permissions(channel.guild.get_role(role), roleobj = channel.guild.get_role(role)
send_messages=False, overrides = channel.overwrites_for(roleobj)
overrides.send_messages = False
await channel.set_permissions(roleobj,
overwrite=overrides,
reason=str(ctx.author)) reason=str(ctx.author))
await self.unlock_for_staff(channel, ctx.author) await self.unlock_for_staff(channel, ctx.author)
@ -72,9 +78,12 @@ class Lockdown:
await self.unlock_for_staff(channel, ctx.author) await self.unlock_for_staff(channel, ctx.author)
for role in roles: for role in roles:
await ctx.channel.set_permissions(ctx.guild.get_role(role), roleobj = channel.guild.get_role(role)
send_messages=True, overrides = channel.overwrites_for(roleobj)
reason=str(ctx.author)) overrides.send_messages = True
await channel.set_permissions(roleobj,
overwrite=overrides,
reason=str(ctx.author))
safe_name = await commands.clean_content().convert(ctx, str(ctx.author)) safe_name = await commands.clean_content().convert(ctx, str(ctx.author))
await ctx.send("🔓 Channel unlocked.") await ctx.send("🔓 Channel unlocked.")