how to log when user leaves voice channel discord.py code example
Example 1: python discord bot join voice channel
@bot.command()
async def join(ctx):
channel = ctx.author.voice.channel
await channel.connect()
@bot.command()
async def leave(ctx):
await ctx.voice_client.disconnect()
Example 2: discord py fetch channel by id
channel = discord.utils.get(ctx.guild.channels, name=given_name)
channel_id = channel.id