mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-04-28 12:30:20 +08:00
fix: fix decode token problem, decoupling rename and notifi, rss parser and database
This commit is contained in:
17
src/module/notification/plugin/telegram.py
Normal file
17
src/module/notification/plugin/telegram.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from module.network.request_contents import RequestContent
|
||||
|
||||
class TelegramNotification(RequestContent):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.notification_url = f"https://api.telegram.org/bot{token}/sendMessage"
|
||||
self.chat_id = chat_id
|
||||
|
||||
def post_msg(self, text: str) -> bool:
|
||||
data = {
|
||||
"chat_id": self.chat_id,
|
||||
"text": text,
|
||||
"disable_notification": True,
|
||||
}
|
||||
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