通过 serverJ 推送消息。
(title: str, content: str)
| 289 | |
| 290 | |
| 291 | def serverJ(title: str, content: str) -> None: |
| 292 | """ |
| 293 | 通过 serverJ 推送消息。 |
| 294 | """ |
| 295 | if not push_config.get("PUSH_KEY"): |
| 296 | print("serverJ 服务的 PUSH_KEY 未设置!!\n取消推送") |
| 297 | return |
| 298 | print("serverJ 服务启动") |
| 299 | |
| 300 | data = {"text": title, "desp": content.replace("\n", "\n\n")} |
| 301 | if push_config.get("PUSH_KEY").find("SCT") != -1: |
| 302 | url = f'https://sctapi.ftqq.com/{push_config.get("PUSH_KEY")}.send' |
| 303 | else: |
| 304 | url = f'https://sc.ftqq.com/{push_config.get("PUSH_KEY")}.send' |
| 305 | response = requests.post(url, data=data).json() |
| 306 | |
| 307 | if response.get("errno") == 0 or response.get("code") == 0: |
| 308 | print("serverJ 推送成功!") |
| 309 | else: |
| 310 | print(f'serverJ 推送失败!错误码:{response["message"]}') |
| 311 | |
| 312 | |
| 313 | def pushdeer(title: str, content: str) -> None: |