I can't figure out why this won't do anything:
@bot.command(name="listen", description="Start Listening")
async def record(ctx):
voice = ctx.author.voice
if not voice :
return await ctx.respond("You are not in a voice channel!", ephemeral=True)
else:
vc = await voice.channel.connect()
connections.update({ctx.guild.id: vc})
async def on_voice_state_update():
self_mute = ctx.author.voice.self_mute
if self_mute == False:
await ctx.respond("Listening, partner...", delete_after=5, ephemeral=True)
vc.start_recording(
discord.sinks.WaveSink(),
once_done,
)
if self_mute == True:
if ctx.guild.id in connections:
vc = connections[ctx.guild.id]
vc.stop_recording()
del connections[ctx.guild.id]
await ctx.delete()
await ctx.respond("I will start to listen.")```
The once_done is a separate event that works on it's own so I think that the problem is in the actual mute-unmute part. I used to do it with buttons and it worked well but was unpractical. It would be great if anyone could help me figure this out :) Cheers! 

