join command

This commit is contained in:
rzmk 2021-05-21 03:28:47 -04:00
parent 9cd0f5bf8a
commit 71b5e064d3

View file

@ -107,12 +107,20 @@ class MusicCog(commands.Cog):
voice = ctx.voice_client voice = ctx.voice_client
voice.stop() voice.stop()
'''@commands.command(aliases=['join']) @commands.command(aliases=['join'])
async def connect(self, ctx): async def connect(self, ctx):
channel = ctx.author.voice.channel channel = ctx.author.voice.channel
try:
await channel.connect()
except:
voice = ctx.voice_client
if voice.is_connected():
await voice.disconnect()
await channel.connect()
else:
await channel.connect() await channel.connect()
@commands.command(aliases=['dc','leave']) '''@commands.command(aliases=['dc','leave'])
async def disconnect(self, ctx): async def disconnect(self, ctx):
await ctx.voice_client.disconnect()''' await ctx.voice_client.disconnect()'''