mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-04-27 20:11:21 +08:00
change: Decoupling of notification module
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
import logging
|
||||
|
||||
from module.network.request_contents import RequestContent
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TelegramNotification(RequestContent):
|
||||
def __init__(self):
|
||||
def __init__(self, token, chat_id):
|
||||
super().__init__()
|
||||
self.notification_url = f"https://api.telegram.org/bot{token}/sendMessage"
|
||||
self.chat_id = chat_id
|
||||
@@ -14,4 +19,4 @@ class TelegramNotification(RequestContent):
|
||||
}
|
||||
resp = self.post_data(self.notification_url, data)
|
||||
logger.debug(f"Telegram notification: {resp.status_code}")
|
||||
return resp.status_code == 200
|
||||
return resp.status_code == 200
|
||||
|
||||
Reference in New Issue
Block a user