🐛 Fix failure to add entry when description is empty

This commit is contained in:
洛水居室 2023-02-22 14:18:45 +08:00
parent 9c8def3ce9
commit 346e78481f
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC

View File

@ -132,12 +132,14 @@ class WeaponPlugin(Plugin, BasePlugin):
allow_sending_without_reply=True, allow_sending_without_reply=True,
) )
if reply_photo.photo: if reply_photo.photo:
description = weapon_data.story
if description:
photo_file_id = reply_photo.photo[0].file_id photo_file_id = reply_photo.photo[0].file_id
tags = _weapons_data.get(weapon_name) tags = _weapons_data.get(weapon_name)
entry = WeaponEntry( entry = WeaponEntry(
key=f"plugin:weapon:{weapon_name}", key=f"plugin:weapon:{weapon_name}",
title=weapon_name, title=weapon_name,
description=weapon_data.story, description=description,
tags=tags, tags=tags,
photo_file_id=photo_file_id, photo_file_id=photo_file_id,
) )