discord - 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)
解决方案
推荐阅读
- c++ - 内存泄漏 Valgrind 不报告,但代码使用了这么多内存
- c++ - 用动态规划找到最长的卡片序列
- r - R:可变长度不同
- c# - 如何在不等待的情况下在后台启动 Redis 连接
- android - Android PaymentsClient.isReadyToPay 中的 Google Pay 返回 false
- javascript - 如何防止在 Windows 10 中更改音量时显示 YouTube 视频名称。[YouTube IFrame Api]
- sql - 索引是否有助于 sql 选择排序性能?
- bash - 从表中提取值小于和大于shell中列的行
- amazon-s3 - 安装 Ambari,无法从 amazon S3 下载 hortonworks HDP
- vue.js - 是否可以为客户端渲染的 Quasar 应用程序加载动态元标记?