lockdown: https://elixi.re/i/ohha7362.mp4 (fixes overrides - hopefully)
This commit is contained in:
parent
e66a178b11
commit
f2e210b9e3
1 changed files with 16 additions and 7 deletions
|
@ -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.")
|
||||||
|
|
Loading…
Reference in a new issue