MCPcopy Index your code
hub / github.com/smallfawn/QLScriptPublic / weplus_bot

Function weplus_bot

daily/notify.py:429–457  ·  view source on GitHub ↗

通过 微加机器人 推送消息。

(title: str, content: str)

Source from the content-addressed store, hash-verified

427
428
429def weplus_bot(title: str, content: str) -> None:
430 """
431 通过 微加机器人 推送消息。
432 """
433 if not push_config.get("WE_PLUS_BOT_TOKEN"):
434 return
435 print("微加机器人 服务启动")
436
437 template = "txt"
438 if len(content) > 800:
439 template = "html"
440
441 url = "https://www.weplusbot.com/send"
442 data = {
443 "token": push_config.get("WE_PLUS_BOT_TOKEN"),
444 "title": title,
445 "content": content,
446 "template": template,
447 "receiver": push_config.get("WE_PLUS_BOT_RECEIVER"),
448 "version": push_config.get("WE_PLUS_BOT_VERSION"),
449 }
450 body = json.dumps(data).encode(encoding="utf-8")
451 headers = {"Content-Type": "application/json"}
452 response = requests.post(url=url, data=body, headers=headers).json()
453
454 if response["code"] == 200:
455 print("微加机器人 推送成功!")
456 else:
457 print("微加机器人 推送失败!")
458
459
460def qmsg_bot(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