carbon 修复自己发送代码或非代码文件时的意外报错
All checks were successful
Github commit to telegram / build (push) Successful in 13s

This commit is contained in:
loneshore 2024-08-12 13:05:04 +08:00 committed by GitHub
parent 254ca02533
commit e1fd0ad3b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -20,7 +20,7 @@ async def get_from_file(message: Message) -> str:
reply = message.reply_to_message reply = message.reply_to_message
if message.document and message.document.mime_type.startswith("text"): if message.document and message.document.mime_type.startswith("text"):
msg = message msg = message
elif reply.document and reply.document.mime_type.startswith("text"): elif reply and reply.document and reply.document.mime_type.startswith("text"):
msg = reply msg = reply
if msg: if msg:
path = await msg.download() path = await msg.download()