(ctx context.Context, msgId *string, cardContent string, )
| 53 | } |
| 54 | |
| 55 | func replyCard(ctx context.Context, |
| 56 | msgId *string, |
| 57 | cardContent string, |
| 58 | ) error { |
| 59 | client := initialization.GetLarkClient() |
| 60 | resp, err := client.Im.Message.Reply(ctx, larkim.NewReplyMessageReqBuilder(). |
| 61 | MessageId(*msgId). |
| 62 | Body(larkim.NewReplyMessageReqBodyBuilder(). |
| 63 | MsgType(larkim.MsgTypeInteractive). |
| 64 | Uuid(uuid.New().String()). |
| 65 | Content(cardContent). |
| 66 | Build()). |
| 67 | Build()) |
| 68 | |
| 69 | // 处理错误 |
| 70 | if err != nil { |
| 71 | fmt.Println(err) |
| 72 | return err |
| 73 | } |
| 74 | |
| 75 | // 服务端错误处理 |
| 76 | if !resp.Success() { |
| 77 | logger.Errorf("服务端错误 resp code[%v], msg [%v] requestId [%v] ", resp.Code, resp.Msg, resp.RequestId()) |
| 78 | return errors.New(resp.Msg) |
| 79 | } |
| 80 | return nil |
| 81 | } |
| 82 | |
| 83 | func newSendCard( |
| 84 | header *larkcard.MessageCardHeader, |
no outgoing calls
no test coverage detected