Created
February 26, 2021 10:04
-
-
Save Kakarot-2000/9c2b327f52de9cc1933cf21bde7bc5b9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@bot.command(name='join', help='Tells the bot to join the voice channel') | |
async def join(ctx): | |
if not ctx.message.author.voice: | |
await ctx.send("{} is not connected to a voice channel".format(ctx.message.author.name)) | |
return | |
else: | |
channel = ctx.message.author.voice.channel | |
await channel.connect() | |
@bot.command(name='leave', help='To make the bot leave the voice channel') | |
async def leave(ctx): | |
voice_client = ctx.message.guild.voice_client | |
if voice_client.is_connected(): | |
await voice_client.disconnect() | |
else: | |
await ctx.send("The bot is not connected to a voice channel.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment