MCPcopy Create free account
hub / github.com/MoMingRose/QLAutomateTasks / feishu_bot

Function feishu_bot

notify.py:211–227  ·  view source on GitHub ↗

使用 飞书机器人 推送消息。

(title: str, content: str)

Source from the content-addressed store, hash-verified

209
210
211def 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
230def go_cqhttp(title: str, content: str) -> None:

Callers

nothing calls this directly

Calls 1

printFunction · 0.85

Tested by

no test coverage detected