我的不和谐机器人遇到一个奇怪的问题。直到今天,一切都还不错,但是突然之间,当我将> play命令与诸如> play Spiderman pizza之类的搜索查询一起使用时,突然在视频即将播放时得到“ WARNING:root:NoneType:None”。如果我在> play命令之后使用URL,它仍然可以像以前一样完美地工作。我看过了,但看不到问题。这是我的play命令的主要代码,其中包含诸如排队系统和权限检查之类的东西,因为它们并不相关。
@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)