Как сменить название голосового канала? Discord.py
@commands.Cog.listener()
async def on_voice_state_update(self, member, before, after):
if after.channel != None:
if after.channel.id == 970690442997932146:
category = after.channel.category
channel2 = await member.guild.create_voice_channel(
name = f'{ member.display_name }',
category = category,
)
await channel2.set_permissions(member, connect = True)
await member.move_to(channel2)
def check(x, y, z): return len(channel2.members) == 0
await self.bot.wait_for('voice_state_update', check = check)
await channel2.delete()
@commands.command()
async def lock(self, ctx):
if ctx.author.voice and ctx.author.voice.channel:
channel = ctx.author.voice.channel
await channel.set_permissions(discord.utils.get(ctx.guild.roles, id=970690442553327706), connect = False)
await ctx.send('Канал закрыт')
else:
await ctx.send("Вы не находитесь в голосовом канале")
return
@commands.command()
async def unlock(self, ctx):
if ctx.author.voice and ctx.author.voice.channel:
channel = ctx.author.voice.channel
await channel.set_permissions(discord.utils.get(ctx.guild.roles,id=970690442553327706), connect = True)
await ctx.send('Канал открыт')
else:
await ctx.send("Вы не находитесь в голосовом канале")
return
Надо добавить команду по смене названия канала, на то что человек напишет