Merge pull request #37 from lyz05/0807pushplus
Some checks failed
SyncMirror / sync (push) Has been cancelled

feat: PushPlus 推送支持
This commit is contained in:
Pesy Wu 2025-08-07 15:44:35 +08:00 committed by GitHub
commit 056c5528e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 0 deletions

View File

@ -15,6 +15,9 @@ notifications:
telegram:
bot_token: "6689586847:AAH0lg1uuXiZMsou9WNYif7qqrbCSdZWWj0"
chat_id: "1762053255"
# PushPlus推送加https://www.pushplus.plus/
pushplus:
key: ""
######## 以下为账号配置项,可以多账号,详情请参考文档 ########
accounts:

25
main.py
View File

@ -153,6 +153,31 @@ def send_notifications(message: str, settings: dict, proxy: str = None):
else:
logger.debug("DingTalk not configured.")
# PushPlus
sct_conf = settings.get("pushplus", {})
sct_key = sct_conf.get("key")
if sct_key:
sct_url = f"http://www.pushplus.plus/send/{sct_key}"
try:
payload = {"title": "MHYY-AutoCheckin 状态推送", "content": message}
response = httpx.post(sct_url, data=payload, timeout=10)
response.raise_for_status()
logger.info("PushPlus notification sent successfully.")
except httpx.HTTPStatusError as e:
logger.error(
f"PushPlus HTTP error occurred: {e.response.status_code} - {e.response.text}"
)
except httpx.RequestError as e:
logger.error(f"An error occurred while requesting PushPlus: {e}")
except Exception as e:
logger.error(
f"An unexpected error occurred sending PushPlus notification: {e}"
)
else:
logger.debug("PushPlus not configured.")
# Telegram
telegram_conf = settings.get("telegram", {})
telegram_bot_token = telegram_conf.get("bot_token")
telegram_chat_id = telegram_conf.get("chat_id")