Merge pull request #25 from ImRodry/master

Fix issue with permissions being reset on channel lock
This commit is contained in:
Sam 2021-04-10 13:38:29 +01:00 committed by GitHub
commit 1954ea1be2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -162,9 +162,9 @@ class voice(commands.Cog):
await ctx.channel.send(f"{ctx.author.mention} You don't own a channel.") await ctx.channel.send(f"{ctx.author.mention} You don't own a channel.")
else: else:
channelID = voice[0] channelID = voice[0]
role = discord.utils.get(ctx.guild.roles, name='@everyone') role = ctx.guild.default_role
channel = self.bot.get_channel(channelID) channel = self.bot.get_channel(channelID)
await channel.set_permissions(role, connect=False,read_messages=True) await channel.set_permissions(role, connect=False)
await ctx.channel.send(f'{ctx.author.mention} Voice chat locked! 🔒') await ctx.channel.send(f'{ctx.author.mention} Voice chat locked! 🔒')
conn.commit() conn.commit()
conn.close() conn.close()
@ -180,9 +180,9 @@ class voice(commands.Cog):
await ctx.channel.send(f"{ctx.author.mention} You don't own a channel.") await ctx.channel.send(f"{ctx.author.mention} You don't own a channel.")
else: else:
channelID = voice[0] channelID = voice[0]
role = discord.utils.get(ctx.guild.roles, name='@everyone') role = ctx.guild.default_role
channel = self.bot.get_channel(channelID) channel = self.bot.get_channel(channelID)
await channel.set_permissions(role, connect=True,read_messages=True) await channel.set_permissions(role, connect=True)
await ctx.channel.send(f'{ctx.author.mention} Voice chat unlocked! 🔓') await ctx.channel.send(f'{ctx.author.mention} Voice chat unlocked! 🔓')
conn.commit() conn.commit()
conn.close() conn.close()