t renew discord.py机器人创建ytdl播放器不会更新

2024-09-28 22:05:48 发布

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

我对创建一个不和谐的机器人(通常是机器人)和提问是相当陌生的。在

我想让它加入一个频道,播放一首YouTube歌曲。在

我尝试过create_ffmpeg_player并启动播放器,但当我尝试create_ytdl_player()函数时,它似乎无法播放任何音乐。在

我看了所有的文档和网络上的人的例子,但似乎我不能让它工作。在

机器人应该通过id进入音乐频道并播放YouTube上的歌曲。在

这是我的代码:

@client.event
@asyncio.coroutine
def on_ready():
    print('bot is on!')
    channel = client.get_channel('channel id')
    voice = yield from client.join_voice_channel(channel)
    use_avconv = ('use_avconv', False)
    opts = {
            'format': 'webm[abr>0]/bestaudio/best',
            'prefer_ffmpeg': not use_avconv
        }
    player = yield from voice.create_ytdl_player('song url',ytdl_options=opts)
    # ffmpeg player works
    # p = voice.create_ffmpeg_player(player.download_url)
    player.volume = 0.5
    player.start()
    print('playing')

I am getting this:

FFmpeg version SVN-r21566-xuggle-3.4.843, Copyright (c) 2000-2010 Fabrice Bellard, et al. built on Jan 31 2010 09:45:05 with gcc 4.2.4

(TDM-1 for MinGW)
configuration: --prefix=/usr/local --extra-version=xuggle-3.4.843 --extra-cflags=-I/c/hudson/slave/workspace/xuggle_xuggler_binary_build/jdk/JDK5/label/WindowsXP_i386/build/native/i686-pc-mingw32/captive/usr/local/include --extra-ldflags=-L/c/hudson/slave/workspace/xuggle_xuggler_binary_build/jdk/JDK5/label/WindowsXP_i386/build/native/i686-pc-mingw32/captive/usr/local/lib --enable-shared --enable-gpl --enable-nonfree --enable-version3 --enable-libx264 --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-amrwb --extra-cflags=-mno-cygwin --extra-cflags=-fno-common --extra-ldflags=-mno-cygwin --extra-ldflags=--out-implib --enable-w32threads --enable-memalign-hack >libavutil 50. 8. 0 / 50. 8. 0

libavcodec 52.49. 0 / 52.49. 0

libavformat 52.48. 0 / 52.48. 0

libavdevice 52. 2. 0 / 52. 2. 0

libswscale 0. 9. 0 / 0. 9. 0


Tags: buildclientuseonenablecreatechannel机器人