MCPcopy
hub / github.com/smallfawn/QLScriptPublic / serverJ

Function serverJ

notify.py:317–339  ·  view source on GitHub ↗

通过 serverJ 推送消息。

(title: str, content: str)

Source from the content-addressed store, hash-verified

315
316
317def serverJ(title: str, content: str) -> None:
318 """
319 通过 serverJ 推送消息。
320 """
321 if not push_config.get("PUSH_KEY"):
322 return
323 print("serverJ 服务启动")
324
325 data = {"text": title, "desp": content.replace("\n", "\n\n")}
326
327 match = re.match(r"sctp(\d+)t", push_config.get("PUSH_KEY"))
328 if match:
329 num = match.group(1)
330 url = f'https://{num}.push.ft07.com/send/{push_config.get("PUSH_KEY")}.send'
331 else:
332 url = f'https://sctapi.ftqq.com/{push_config.get("PUSH_KEY")}.send'
333
334 response = requests.post(url, data=data).json()
335
336 if response.get("errno") == 0 or response.get("code") == 0:
337 print("serverJ 推送成功!")
338 else:
339 print(f'serverJ 推送失败!错误码:{response["message"]}')
340
341
342def pushdeer(title: str, content: str) -> None:

Callers

nothing calls this directly

Calls 3

printFunction · 0.70
getMethod · 0.45
postMethod · 0.45

Tested by

no test coverage detected