修复了歌曲TG预览时显示时长为0的bug

This commit is contained in:
TNTcraftHIM 2020-08-29 17:20:49 +08:00
parent d3a2e24189
commit 432ac7db3d
2 changed files with 6 additions and 4 deletions

View File

@ -282,10 +282,10 @@
},
{
"name": "neteasemusic",
"version": "2.7",
"version": "2.8",
"section": "daily",
"maintainer": "TNTcraftHIM",
"size": "24.3 kb",
"size": "25.0 kb",
"supported": true,
"des-short": "网易云点歌",
"des": "可以在线搜索并且快速点歌歌曲信息齐全支持直接回复点歌。命令nem。"

View File

@ -383,14 +383,16 @@ async def nem(context):
' <strong>这里</strong> ' + '</a>' + '前往网页版收听'
await bot.send_message(context.chat_id, f"<strong>【{info['title']}】</strong>\n" + "歌曲获取失败,资源获取可能受限,你可以再次尝试。\n" + res, parse_mode='html', link_preview=True)
return
duration=0
if imported is True:
await context.edit(f"{title}信息导入中 . . .")
try:
imagedata = requests.get(
info['albumpic'], headers=headers).content
except:
await bot.send_message(context.chat_id, '~ 封面好像获取失败了呢,不要在意不要在意 ~ ')
await bot.send_message(context.chat_id, '封面好像获取失败了呢,不要在意不要在意 ~ ')
tag = eyed3.load(name)
duration = int(tag.info.time_secs)
tag.initTag()
tag = tag.tag
tag.artist = info['artist']
@ -417,7 +419,7 @@ async def nem(context):
link_preview=False,
force_document=False,
attributes=(DocumentAttributeAudio(
0, False, info['title'], info['artist']),)
duration, False, info['title'], info['artist']),)
)
try:
if reply.sender.is_self: