首页 > 解决方案 > youtube-dl 的 Discord.py Bot 问题

问题描述

我的不和谐机器人有一个奇怪的问题。直到今天一切都很好,但突然间,当我使用 >play 命令和搜索查询(例如 >play 蜘蛛侠披萨)时,当视频即将播放时,我得到了“WARNING:root:NoneType:None”。如果我在 >play 命令之后使用 URL,它仍然可以像以前一样完美地工作。我已经看过了,我只是看不到问题所在。这是我的播放命令的主要代码,其中包含排队系统和权限检查等内容,因为它不相关。

@client.command(pass_context=True)
async def play(ctx,*, url):
                server = ctx.message.server
                voice_client = client.voice_client_in(server)
                player = await voice_client.create_ytdl_player(url, ytdl_options={'default_search': 'auto'}, after =lambda: check_queue(server.id))
                players[server.id] = player
                player.volume = 0.18
                embed=discord.Embed(title=("⏬ Audio downloaded succesfully ⏬"), color=0x9400D3)
                await client.say(embed=embed)
                await asyncio.sleep(0.2)
                embed=discord.Embed(title=(player.uploader), description=(player.description), color=0x9400D3)
                embed.set_author(name=(player.title), url=(player.url) , icon_url='https://upload.wikimedia.org/wikipedia/commons/7/73/YouTube_Music.png')
                embed.add_field(name="Duration(in seconds):", value=(player.duration), inline=True)
                embed.add_field(name="Current Views:", value=(player.views), inline=True)
                embed.add_field(name="Likes:", value=(player.likes), inline=True)
                embed.add_field(name="Dislikes:", value=(player.dislikes), inline=True)
                embed.set_footer(text=random.choice(messages))
                await client.say(embed=embed)
                players[server.id] = player
                player.start()
                await asyncio.sleep(0.2)
                embed=discord.Embed(title=(" Now Playing "), color=0x9400D3)
                await client.say(embed=embed)

标签: discorddiscord.pyyoutube-dl

解决方案


推荐阅读