通过Chat 推送消息
(title: str, content: str)
| 337 | |
| 338 | |
| 339 | def chat(title: str, content: str) -> None: |
| 340 | """ |
| 341 | 通过Chat 推送消息 |
| 342 | """ |
| 343 | if not push_config.get("CHAT_URL") or not push_config.get("CHAT_TOKEN"): |
| 344 | print("chat 服务的 CHAT_URL或CHAT_TOKEN 未设置!!\n取消推送") |
| 345 | return |
| 346 | print("chat 服务启动") |
| 347 | data = "payload=" + json.dumps({"text": title + "\n" + content}) |
| 348 | url = push_config.get("CHAT_URL") + push_config.get("CHAT_TOKEN") |
| 349 | response = requests.post(url, data=data) |
| 350 | |
| 351 | if response.status_code == 200: |
| 352 | print("Chat 推送成功!") |
| 353 | else: |
| 354 | print("Chat 推送失败!错误信息:", response) |
| 355 | |
| 356 | |
| 357 | def pushplus_bot(title: str, content: str) -> None: |