Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import discord
- from discord.ext import commands
- players = {}
- client = commands.Bot(command_prefix = "!")
- @client.event
- async def on_ready():
- print(f'{client.user} has connected to Discord!')
- await client.change_presence(activity=discord.Game(name="with your words!"))
- # called_once_an_hour.start()
- @client.command()
- async def test(ctx):
- await ctx.send('test')
- @client.command()
- async def join(ctx):
- channel = ctx.message.author.voice.voice_channel
- await client.join_voice_channel(channel)
- @client.command(pass_context = True)
- async def leave(ctx):
- server = ctx.message.server
- voice_client = client.voice_client_in(server)
- await voice_client.disconnect()
- @client.command(pass_context = True)
- async def play(ctx):
- server = ctx.message.server
- voice_client = client.voice_client_in(server)
- player = await voice_client.create_ytdl_player('https://www.youtube.com/watch?v=YMw-9mXfccY')
- players[server.id] = player
- player.start()
- print(f"Playing Are you winning son in server voice client: {voice_client}")
- client.run(os.environ.get('TOKEN'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement