mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-04-30 13:31:05 +08:00
fix: tg notification
This commit is contained in:
@@ -2,6 +2,7 @@ import logging
|
||||
|
||||
from module.models import Notification
|
||||
from module.network import RequestContent
|
||||
from module.utils import load_image
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -24,9 +25,14 @@ class TelegramNotification(RequestContent):
|
||||
data = {
|
||||
"chat_id": self.chat_id,
|
||||
"caption": text,
|
||||
"photo": notify.poster_path,
|
||||
"disable_notification": True,
|
||||
}
|
||||
resp = self.post_data(self.notification_url, data)
|
||||
photo = load_image(notify.poster_path)
|
||||
if photo:
|
||||
resp = self.post_form(
|
||||
self.notification_url, data, files={"photo": photo}
|
||||
)
|
||||
else:
|
||||
resp = self.post_data(self.notification_url, data)
|
||||
logger.debug(f"Telegram notification: {resp.status_code}")
|
||||
return resp.status_code == 200
|
||||
|
||||
Reference in New Issue
Block a user