Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Python-Chatbot/Youtube.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
44 lines (36 sloc)
1.18 KB
This file contains 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
import discord | |
import youtube_dl | |
import asyncio | |
from discord.ext import commands | |
client = commands.Bot(command_prefix = '.') | |
players = {'https://www.youtube.com/'} | |
TOKEN = 'NTA3NjMyNDUwMzkwODUxNTg1.Drzsew.lVbUm7WKIPrV56q_9LegdqZuXZo' | |
"""Code From The online disclord.py documentation""" | |
@client.event | |
async def on_ready(): | |
await client.change_presence(game=discord.Game(name = 'Fortnite like a Boss')) | |
print ("BOT ONLINE") | |
"""""" | |
"""Code From The online disclord.py documentation""" | |
@client.command(pass_context = True) | |
async def join(ctx): | |
channel = ctx.message.author.voice.voice_channel | |
await client.join_voice_channel(channel) | |
"""""" | |
"""Code From The online disclord.py documentation""" | |
@client.command(pass_context = True) | |
async def leave(ctx): | |
server = ctx.message.server | |
voice_channel = client.vocemessage_in(server) | |
await voice_channel.disconnect() | |
"""""" | |
"""Code by Lucas Kumara""" | |
@client.command(pass_context = True) | |
async def play(ctx, url): | |
server = ctx.message.server | |
client = client.voice_client_in(server) | |
player = await voice_client.create_ytdl_player(url) | |
players [server.id] = player | |
player.start() | |
"""""" | |
client.run(TOKEN) |