I've been making a discord bot which enters a vc plays an audio then leaves, but I can't seem to get the leaving part to work. Here is my code:
# Discord specific import
import discord
from discord.ext import commands
import asyncio
Client = discord.Client()
client = commands.Bot(command_prefix="..")
@client.command(pass_context=True)
async def dan(ctx):
author = ctx.message.author
channel = author.voice_channel
vc = await client.join_voice_channel(channel)
player = vc.create_ffmpeg_player('dan.mp3', after=lambda: print('done'))
player.start()
player.disconnect()
client.run('token')
I'm not getting any errors with this but at the same time the bot is not disconnecting from the vc and I have tried changing 'player' for 'client', 'Client' and 'client.voice'