MCPcopy Create free account
hub / github.com/smallfawn/QLScriptPublic / send_mpnews

Method send_mpnews

notify.py:547–571  ·  view source on GitHub ↗
(self, title, message, media_id, touser="@all")

Source from the content-addressed store, hash-verified

545 return respone["errmsg"]
546
547 def send_mpnews(self, title, message, media_id, touser="@all"):
548 send_url = (
549 f"{self.ORIGIN}/cgi-bin/message/send?access_token={self.get_access_token()}"
550 )
551 send_values = {
552 "touser": touser,
553 "msgtype": "mpnews",
554 "agentid": self.AGENTID,
555 "mpnews": {
556 "articles": [
557 {
558 "title": title,
559 "thumb_media_id": media_id,
560 "author": "Author",
561 "content_source_url": "",
562 "content": message.replace("\n", "<br/>"),
563 "digest": message,
564 }
565 ]
566 },
567 }
568 send_msges = bytes(json.dumps(send_values), "utf-8")
569 respone = requests.post(send_url, send_msges)
570 respone = respone.json()
571 return respone["errmsg"]
572
573
574def wecom_bot(title: str, content: str) -> None:

Callers 1

wecom_appFunction · 0.95

Calls 2

get_access_tokenMethod · 0.95
postMethod · 0.45

Tested by

no test coverage detected