Heroku上的不和谐机器人youtube嫒dl和Discord[声音]

2024-04-25 10:24:05 发布

您现在位置:Python中文网/ 问答频道 /正文

Bot代码:

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('')

错误:

^{pr2}$

bot通常在我自己的电脑上运行,但我目前正在Heroku服务器上运行。机器人加入频道,但不播放音频。在

我想不出解决这个问题的办法 提前谢谢你的帮助。在


Tags: importclientasyncserverdefbotchannelpass