Advertisement
Guest User

Untitled

a guest
Apr 1st, 2020
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.71 KB | None | 0 0
  1. @client.command(pass_context=True, aliases=['j'])
  2. async def join(ctx):
  3.     global voice
  4.     channel = ctx.message.author.voice.channel
  5.     voice = get(client.voice_clients, guild=ctx.guild)
  6.  
  7.     if voice and voice.is_connected():
  8.         await voice.move_to(channel)
  9.         print(voice)
  10.     else:
  11.         await ctx.message.channel.send(f'Joined {channel}')
  12.         voice = await channel.connect()
  13.  
  14. @client.command(pass_context=True, aliases=['l'])
  15. async def leave(ctx):
  16.     global voice
  17.  
  18.     channel = ctx.message.author.voice.channel
  19.  
  20.     print(voice)
  21.     voice = get(client.voice_clients, guild=ctx.guild)
  22.  
  23.     if voice and voice.is_connected():
  24.         await voice.disconnect()
  25.     else:
  26.         await ctx.message.channel.send("I'm not in a voice channel")
  27.         print(voice)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement