使用 go_cqhttp 推送消息。
(title: str, content: str)
| 228 | |
| 229 | |
| 230 | def go_cqhttp(title: str, content: str) -> None: |
| 231 | """ |
| 232 | 使用 go_cqhttp 推送消息。 |
| 233 | """ |
| 234 | if not push_config.get("GOBOT_URL") or not push_config.get("GOBOT_QQ"): |
| 235 | print("go-cqhttp 服务的 GOBOT_URL 或 GOBOT_QQ 未设置!!\n取消推送") |
| 236 | return |
| 237 | print("go-cqhttp 服务启动") |
| 238 | |
| 239 | url = f'{push_config.get("GOBOT_URL")}?access_token={push_config.get("GOBOT_TOKEN")}&{push_config.get("GOBOT_QQ")}&message=标题:{title}\n内容:{content}' |
| 240 | response = requests.get(url).json() |
| 241 | |
| 242 | if response["status"] == "ok": |
| 243 | print("go-cqhttp 推送成功!") |
| 244 | else: |
| 245 | print("go-cqhttp 推送失败!") |
| 246 | |
| 247 | |
| 248 | def gotify(title: str, content: str) -> None: |