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

Function qmsg_bot

notify.py:392–408  ·  view source on GitHub ↗

使用 qmsg 推送消息。

(title: str, content: str)

Source from the content-addressed store, hash-verified

390
391
392def qmsg_bot(title: str, content: str) -> None:
393 """
394 使用 qmsg 推送消息。
395 """
396 if not push_config.get("QMSG_KEY") or not push_config.get("QMSG_TYPE"):
397 print("qmsg 的 QMSG_KEY 或者 QMSG_TYPE 未设置!!\n取消推送")
398 return
399 print("qmsg 服务启动")
400
401 url = f'https://qmsg.zendee.cn/{push_config.get("QMSG_TYPE")}/{push_config.get("QMSG_KEY")}'
402 payload = {"msg": f'{title}\n\n{content.replace("----", "-")}'.encode("utf-8")}
403 response = requests.post(url=url, params=payload).json()
404
405 if response["code"] == 0:
406 print("qmsg 推送成功!")
407 else:
408 print(f'qmsg 推送失败!{response["reason"]}')
409
410
411def wecom_app(title: str, content: str) -> None:

Callers

nothing calls this directly

Calls 1

printFunction · 0.85

Tested by

no test coverage detected