当仅发送短信或仅发送图像时,一切正常,但如果您向机器人发送图片和文本,则不会显示消息文本,而是“无”
@TGbot.message_handler(content_types=['text', 'photo'])
def get_text_messages(msg)
print(f"Сообщение: {msg.text}")
if msg.content_type == "photo":
photo = TGbot.get_file(msg.photo[0].file_id)
photo_path = photo.file_path
photo_id = photo.file_id
photo_type = photo.file_path.split('.')[-1]
file = TGbot.download_file(photo_path)
with open(photo_id + "." + photo_type, "wb") as code:
code.write(file)

图像有属性
.caption,消息有属性.text。