使用 qmsg 推送消息。
(title: str, content: str)
| 390 | |
| 391 | |
| 392 | def qmsg_bot(title: str, content: str) -> None: |
| 393 | """ |
| 394 | 使用 qmsg 推送消息。 |
| 395 | """ |
| 396 | if not push_config.get("QMSG_KEY") or not push_config.get("QMSG_TYPE"): |
| 397 | print("qmsg 的 QMSG_KEY 或者 QMSG_TYPE 未设置!!\n取消推送") |
| 398 | return |
| 399 | print("qmsg 服务启动") |
| 400 | |
| 401 | url = f'https://qmsg.zendee.cn/{push_config.get("QMSG_TYPE")}/{push_config.get("QMSG_KEY")}' |
| 402 | payload = {"msg": f'{title}\n\n{content.replace("----", "-")}'.encode("utf-8")} |
| 403 | response = requests.post(url=url, params=payload).json() |
| 404 | |
| 405 | if response["code"] == 0: |
| 406 | print("qmsg 推送成功!") |
| 407 | else: |
| 408 | print(f'qmsg 推送失败!{response["reason"]}') |
| 409 | |
| 410 | |
| 411 | def wecom_app(title: str, content: str) -> None: |