xybot/tool/api.go

27 lines
1.1 KiB
Go

package tool
import (
"gitee.ltd/lxh/xybot/core"
"github.com/go-resty/resty/v2"
)
type API interface {
CheckDatabaseOK() (running bool, err error) // 检查数据库是否正常
IsRunning() (flag bool, err error) // 是否在运行
CdnDownloadImg(aesKey, cdnMidImgUrl string) (dataBase64Str string, err error) // 下载图片
DownloadAttach(attachId string) (dataBase64Str string, err error) // 下载附件
DownloadVideo(msgId int) (dataBase64Str string, err error) // 下载视频
DownloadVoice(msgId int, voiceUrl string, length int) (dataBase64Str string, err error) // 下载语音
SetProxy(param SetProxyRequest) (err error) // 设置代理
SetStep(stepCount int) (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}
}