You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tool/services/wecom/message/text.go

38 lines
673 B

package message
import "gitea.codecodify.com/golang/tool/helper"
type TextReq struct {
BaseReq
Text Text `json:"text"`
Safe int `json:"safe"`
EnableIdTrans int `json:"enable_id_trans"`
}
type Text struct {
Content string `json:"content"`
}
func (t TextReq) name() string {
return "文本消息"
}
func NewTextReq(toUser, toParty, toTag, content string, agentId int) TextReq {
return TextReq{
BaseReq: BaseReq{
Touser: helper.Ternary(toUser == "", "@all", toUser).(string),
Toparty: toParty,
Totag: toTag,
Msgtype: "text",
Agentid: agentId,
},
Text: Text{
Content: content,
},
Safe: 0,
EnableIdTrans: 0,
}
}