Heroku on Discord Bot youtube_dl and discord[voice

2019-08-26 07:40发布

问题:

Bot Code :

import discord
import youtube_dl
from discord.ext import commands

client = commands.Bot(command_prefix = "e!")

players = {}

@client.event
async def on_ready():
    print("Bot çevrimiçi!")

@client.command(pass_context = True)
async def baglan(ctx):
    channel = ctx.message.author.voice.voice_channel
    await client.join_voice_channel(channel)

@client.command(pass_context = True)
async def oynat(ctx, url):
    server = ctx.message.server
    voice_client = client.voice_client_in(server)
    player = await voice_client.create_ytdl_player(url)
    players[server.id] = player
    player.start() 


client.run('')

Error :

packages/discord/ext/commands/core.py", line 54, in wrapped
        raise CommandInvokeError(e) from e
    discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'create_ytdl_player'

The bot is normally running on my own PC but I am currently running on a Heroku server. The bot joins the channel but doesn't play the audio.

I couldn't figure out a way how to solve this problem Thank you in advance for your help.