Heroku on Discord Bot youtube_dl and discord[voice] error

吃可爱长大的小学妹 提交于 2019-12-24 18:48:23

问题


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.

来源:https://stackoverflow.com/questions/52372170/heroku-on-discord-bot-youtube-dl-and-discordvoice-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!