how to leave voice channel discord py

Solutions on MaxInterview for how to leave voice channel discord py by the best coders in the world

showing results for - "how to leave voice channel discord py"
Paris
10 Nov 2017
1import discord
2import pytz
3from discord.ext import commands
4from datetime import datetime
5
6
7@bot.command(aliases=['left',  'l'])
8async def leave(ctx):
9    await ctx.message.delete()
10    try:
11        if ctx.author.voice.channel and ctx.author.voice.channel == ctx.voice_client.channel:
12            await ctx.voice_client.disconnect()
13    except AttributeError:
14        cfbot=discord.Embed(title='404 ,Not Found', description='The system did not find bot in your channel.\nBot may still be in the Channel, but somewhere!', color=0xFFFF00)
15        cfbot.timestamp=datetime.now(pytz.timezone('Asia/Bangkok'))
16        await ctx.send(embed=cfbot ,delete_after=7.5)