🐛 Fix missing mime

This commit is contained in:
xtaodada 2022-03-20 02:23:27 +08:00
parent b126213c49
commit fe641bbe42
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
2 changed files with 3 additions and 3 deletions

View File

@ -42,9 +42,11 @@ def gen_update_msg(data: Module) -> TrackMessage:
data.updatedAt,
data.releases[0].description.replace(r"\r\n", "\n"))
url = None
name = data.name.replace('.', '_') + "-" + data.latestRelease
if data.releases:
if data.releases[0].releaseAssets:
url = data.releases[0].releaseAssets[0].url
name = data.name.replace('.', '_') + "-" + data.latestRelease
mime = data.releases[0].releaseAssets[0].name.split(".")[-1:][0]
name += "." + mime
button = gen_button(data)
return TrackMessage(text, url, name, button)

View File

@ -16,7 +16,6 @@ async def send_track_msg(file, track_msg):
if file:
await app.send_document(channel_id, file,
caption=track_msg.text[:1000],
file_name=track_msg.name,
force_document=True,
parse_mode="html",
reply_markup=track_msg.button)
@ -44,7 +43,6 @@ async def run_every_30_minute():
print(f"Send button error")
await app.send_document(channel_id, file,
caption=track_msg.text,
file_name=track_msg.name,
force_document=True,
parse_mode="html",)
except Exception as e: