使用 飞书机器人 推送消息。
(title: str, content: str)
| 209 | |
| 210 | |
| 211 | def feishu_bot(title: str, content: str) -> None: |
| 212 | """ |
| 213 | 使用 飞书机器人 推送消息。 |
| 214 | """ |
| 215 | if not push_config.get("FSKEY"): |
| 216 | print("飞书 服务的 FSKEY 未设置!!\n取消推送") |
| 217 | return |
| 218 | print("飞书 服务启动") |
| 219 | |
| 220 | url = f'https://open.feishu.cn/open-apis/bot/v2/hook/{push_config.get("FSKEY")}' |
| 221 | data = {"msg_type": "text", "content": {"text": f"{title}\n\n{content}"}} |
| 222 | response = requests.post(url, data=json.dumps(data)).json() |
| 223 | |
| 224 | if response.get("StatusCode") == 0: |
| 225 | print("飞书 推送成功!") |
| 226 | else: |
| 227 | print("飞书 推送失败!错误信息如下:\n", response) |
| 228 | |
| 229 | |
| 230 | def go_cqhttp(title: str, content: str) -> None: |