MCPcopy
hub / github.com/eatmoreapple/openwechat / sendMessage

Method sendMessage

client.go:401–417  ·  view source on GitHub ↗

发送消息

(ctx context.Context, request *BaseRequest, url string, msg *SendMessage)

Source from the content-addressed store, hash-verified

399
400// 发送消息
401func (c *Client) sendMessage(ctx context.Context, request *BaseRequest, url string, msg *SendMessage) (*http.Response, error) {
402 content := map[string]interface{}{
403 "BaseRequest": request,
404 "Msg": msg,
405 "Scene": 0,
406 }
407 body, err := jsonEncode(content)
408 if err != nil {
409 return nil, err
410 }
411 req, err := http.NewRequestWithContext(ctx, http.MethodPost, url, body)
412 if err != nil {
413 return nil, err
414 }
415 req.Header.Add("Content-Type", jsonContentType)
416 return c.Do(req)
417}
418
419type ClientWebWxSendMsgOptions struct {
420 LoginInfo *LoginInfo

Callers 5

WebWxSendMsgMethod · 0.95
WebWxSendEmoticonMethod · 0.95
WebWxSendMsgImgMethod · 0.95
WebWxSendAppMsgMethod · 0.95
WebWxSendVideoMsgMethod · 0.95

Calls 2

DoMethod · 0.95
jsonEncodeFunction · 0.85

Tested by

no test coverage detected