fix telegram notification wrong when no image

This commit is contained in:
shininome
2023-10-09 09:38:28 +08:00
parent ddd17ec0e5
commit 521d3f20d8

View File

@@ -26,13 +26,12 @@ class TelegramNotification(RequestContent):
data = {
"chat_id": self.chat_id,
"caption": text,
"text": text,
"disable_notification": True,
}
photo = load_image(notify.poster_path)
if photo:
resp = self.post_files(
self.photo_url, data, files={"photo": photo}
)
resp = self.post_files(self.photo_url, data, files={"photo": photo})
else:
resp = self.post_data(self.message_url, data)
logger.debug(f"Telegram notification: {resp.status_code}")