32 lines
2.2 KiB
Go
32 lines
2.2 KiB
Go
package message
|
||
|
||
import (
|
||
"gitee.ltd/lxh/xybot/core"
|
||
"github.com/go-resty/resty/v2"
|
||
)
|
||
|
||
type API interface {
|
||
RevokeMsg(toWxId string, clientMsgId, createTime, newMsgId int) (err error) // 撤回消息
|
||
SendAppMsg(toWxId, xml string, appMsgType int) (clientMsgId, createTime, newMsgId int, err error) // 发送App消息
|
||
SendCDNFileMsg(toWxId, xml string) (clientMsgId, createTime, newMsgId int, err error) // 发送CDN文件消息
|
||
SendCDNImgMsg(toWxId, xml string) (clientMsgId, createTime, newMsgId int, err error) // 发送CDN图片消息(转发图片消息)
|
||
SendCDNVideoMsg(toWxId, xml string) (clientMsgId, createTime, newMsgId int, err error) // 发送CDN视频消息(转发视频消息)
|
||
SendCardMsg(toWxId, cardWxId, cardNickname, cardAlias string) (clientMsgId, createTime, newMsgId int, err error) // 发送名片消息
|
||
SendEmojiMsg(toWxId, md5 string, length int) (resp any, err error) // 发送表情消息
|
||
SendImageMsg(toWxId, imgBase64Str string) (clientMsgId, createTime, newMsgId int, err error) // 发送图片消息
|
||
SendShareLink(toWxId, url, title, description, thumbUrl string) (clientMsgId, createTime, newMsgId int, err error) // 发送分享链接消息
|
||
SendTextMsg(toWxId, content string, atUser []string) (clientMsgId, createTime, newMsgId int, err error) // 发送文本消息
|
||
SendVideoMsg(toWxId, video, cover string, duration int) (clientMsgId, createTime, newMsgId int, err error) // 发送视频消息 不推荐使用,上传速度很慢300KB/s。如要使用,可压缩视频,或者发送链接卡片而不是视频。
|
||
SendVoiceMsg(toWxId, voice, format string, duration int) (clientMsgId, createTime, newMsgId int, err error) // 发送语音消息
|
||
Sync() (msg []SyncMessage, err error) // 同步消息
|
||
}
|
||
|
||
type service struct {
|
||
client *resty.Client
|
||
robotInfo *core.RobotInfo
|
||
}
|
||
|
||
func New(client *resty.Client, robotInfo *core.RobotInfo) API {
|
||
return &service{client: client, robotInfo: robotInfo}
|
||
}
|