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

Function serverJ

notify.py:291–310  ·  view source on GitHub ↗

通过 serverJ 推送消息。

(title: str, content: str)

Source from the content-addressed store, hash-verified

289
290
291def serverJ(title: str, content: str) -> None:
292 """
293 通过 serverJ 推送消息。
294 """
295 if not push_config.get("PUSH_KEY"):
296 print("serverJ 服务的 PUSH_KEY 未设置!!\n取消推送")
297 return
298 print("serverJ 服务启动")
299
300 data = {"text": title, "desp": content.replace("\n", "\n\n")}
301 if push_config.get("PUSH_KEY").find("SCT") != -1:
302 url = f'https://sctapi.ftqq.com/{push_config.get("PUSH_KEY")}.send'
303 else:
304 url = f'https://sc.ftqq.com/{push_config.get("PUSH_KEY")}.send'
305 response = requests.post(url, data=data).json()
306
307 if response.get("errno") == 0 or response.get("code") == 0:
308 print("serverJ 推送成功!")
309 else:
310 print(f'serverJ 推送失败!错误码:{response["message"]}')
311
312
313def pushdeer(title: str, content: str) -> None:

Callers

nothing calls this directly

Calls 1

printFunction · 0.85

Tested by

no test coverage detected