通过Chat 推送消息
(title: str, content: str)
| 365 | |
| 366 | |
| 367 | def chat(title: str, content: str) -> None: |
| 368 | """ |
| 369 | 通过Chat 推送消息 |
| 370 | """ |
| 371 | if not push_config.get("CHAT_URL") or not push_config.get("CHAT_TOKEN"): |
| 372 | return |
| 373 | print("chat 服务启动") |
| 374 | data = "payload=" + json.dumps({"text": title + "\n" + content}) |
| 375 | url = push_config.get("CHAT_URL") + push_config.get("CHAT_TOKEN") |
| 376 | response = requests.post(url, data=data) |
| 377 | |
| 378 | if response.status_code == 200: |
| 379 | print("Chat 推送成功!") |
| 380 | else: |
| 381 | print("Chat 推送失败!错误信息:", response) |
| 382 | |
| 383 | |
| 384 | def pushplus_bot(title: str, content: str) -> None: |