package message 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: toUser, Toparty: toParty, Totag: toTag, Msgtype: "text", Agentid: agentId, }, Text: Text{ Content: content, }, Safe: 0, EnableIdTrans: 0, } }