如何显示当前流式广播电台。 [Discord.py重写]

时间:2020-05-15 23:27:03

标签: python python-3.x discord discord.py discord.py-rewrite

我有一个不和谐的bot,可以播放在线广播节目,并且我正在尝试实现一个功能(命令),该功能将显示该机器人正在播放的当前电台,但会停留一半。

@bot.command()
async def current(ctx):
    voice = get(bot.voice_clients, guild=ctx.guild)
    station = voice.source
    if voice.is_playing():
        print(f'Currently playing {station}')
        await ctx.send(f'Current station {station}.')

机器人接收站流的方式是使用直接音频流URL,这是一个站的示例:

@bot.command(aliases=['1'])
async def core(ctx):
    global player
    channel = ctx.message.author.voice.channel
    try:
        player = await channel.connect()
    except:
        pass
    if player.is_playing():
        player.stop()
    player.play(FFmpegPCMAudio('http://serv.coreradio.ru:8000/coreradio'))
    await ctx.channel.send('Playing: Core radio!\n')
    await ctx.send(warning)

因此该命令确实可以工作并返回音频源,但是问题在于它以字符串形式返回,该字符串是无法理解的字符(discord.player.FFmpegPCMAudio对象位于0x046325B0)。

我的问题是如何将其转换为显示实际的电台播放情况?

0 个答案:

没有答案