通过 serverJ 推送消息。
(title: str, content: str)
| 315 | |
| 316 | |
| 317 | def serverJ(title: str, content: str) -> None: |
| 318 | """ |
| 319 | 通过 serverJ 推送消息。 |
| 320 | """ |
| 321 | if not push_config.get("PUSH_KEY"): |
| 322 | return |
| 323 | print("serverJ 服务启动") |
| 324 | |
| 325 | data = {"text": title, "desp": content.replace("\n", "\n\n")} |
| 326 | |
| 327 | match = re.match(r"sctp(\d+)t", push_config.get("PUSH_KEY")) |
| 328 | if match: |
| 329 | num = match.group(1) |
| 330 | url = f'https://{num}.push.ft07.com/send/{push_config.get("PUSH_KEY")}.send' |
| 331 | else: |
| 332 | url = f'https://sctapi.ftqq.com/{push_config.get("PUSH_KEY")}.send' |
| 333 | |
| 334 | response = requests.post(url, data=data).json() |
| 335 | |
| 336 | if response.get("errno") == 0 or response.get("code") == 0: |
| 337 | print("serverJ 推送成功!") |
| 338 | else: |
| 339 | print(f'serverJ 推送失败!错误码:{response["message"]}') |
| 340 | |
| 341 | |
| 342 | def pushdeer(title: str, content: str) -> None: |