Проблемы с youtube-dl Discord Python Bot - PullRequest
0 голосов
/ 10 апреля 2019

Я создаю бота на Python Discord, который играет немного музыки. Проблема в том, что иногда это выдает ошибку, и бот пропускает песню (или отключается от голосового канала, если в очереди больше нет песен). Вот и весь мой музыкальный код:

@client.command(pass_context=True)

async def uneix(ctx):
    channel=ctx.message.author.voice.voice_channel
    await client.join_voice_channel(channel)
    await client.say("Afegit amb èxit! :white_check_mark:")

@client.command(pass_context=True)

async def para(ctx):
    server=ctx.message.server
    voice_client=client.voice_client_in(server)
    await voice_client.disconnect()
    await client.say("Desconectat amb èxit!  :white_check_mark:")



@client.command(pass_context=True)
async def cançó(ctx, url):
    server = ctx.message.server
    channel=ctx.message.author.voice.voice_channel
    await client.join_voice_channel(channel)
    player = await client.voice_client_in(server).create_ytdl_player(url, after = lambda: check_queue(server.id))
    players[server.id] = player
    player.start()

    await client.say("**Buscant cançó...**")
    await client.say("**Reproduïnt cançó! :robot:**")

@client.command(pass_context=True)
async def pausa(ctx):
    id = ctx.message.server.id
    players[id].pause()
    await client.say("**Pausant cançó... :robot:**")

@client.command(pass_context=True)
async def seguent(ctx):
    id = ctx.message.server.id
    players[id].stop()
    await client.say("**Seguent cançó... :robot:**")
@client.command(pass_context=True)
async def resumeix(ctx):
    id = ctx.message.server.id
    players[id].resume()
    await client.say("**Resumint cançó... :robot:**")



@client.command(pass_context=True)

async def lista(ctx, url):
    server = ctx.message.server
    voice_client = client.voice_client_in(server)
    player = await voice_client.create_ytdl_player(url, after = lambda: check_queue(server.id))
    if server.id in queues:
            queues[server.id].append(player)
    else:
            queues[server.id] = [player]

    await client.say("**Vídeo afegit a la llista** :white_check_mark: :robot: ")

И это проблема: Фото

Я искал некоторые решения, но они не работали, вся помощь будет оценена.

PD: я использую async.

...