Advertisement
SoonCorrupt

63998322/discord-py-command-prefix-not-calling-out-commands/63998758?noredirect=1

Sep 21st, 2020 (edited)
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.13 KB | None | 0 0
  1. import os
  2. import discord
  3. from discord.ext import commands
  4.  
  5.  
  6. players = {}
  7.  
  8. client = commands.Bot(command_prefix = "!")
  9.  
  10. @client.event
  11. async def on_ready():
  12.     print(f'{client.user} has connected to Discord!')
  13.     await client.change_presence(activity=discord.Game(name="with your words!"))
  14.     # called_once_an_hour.start()
  15.  
  16. @client.command()
  17. async def test(ctx):
  18.     await ctx.send('test')
  19.  
  20. @client.command()
  21. async def join(ctx):
  22.     channel = ctx.message.author.voice.voice_channel
  23.     await client.join_voice_channel(channel)
  24.  
  25. @client.command(pass_context = True)
  26. async def leave(ctx):
  27.     server = ctx.message.server
  28.     voice_client = client.voice_client_in(server)
  29.     await voice_client.disconnect()
  30.  
  31. @client.command(pass_context = True)
  32. async def play(ctx):
  33.     server = ctx.message.server
  34.     voice_client = client.voice_client_in(server)
  35.     player = await voice_client.create_ytdl_player('https://www.youtube.com/watch?v=YMw-9mXfccY')
  36.     players[server.id] = player
  37.     player.start()
  38.     print(f"Playing Are you winning son in server voice client: {voice_client}")
  39.  
  40.  
  41. client.run(os.environ.get('TOKEN'))
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement