apiBuilder

package
v2.0.0-...-0c94b36 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 20 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPicHW

func GetPicHW(pic []byte) (height, width int)

Types

type Builder

type Builder struct {
	CgiCmd     *string     `json:"CgiCmd,omitempty"`
	CgiRequest *CgiRequest `json:"CgiRequest,omitempty"`
	// contains filtered or unexported fields
}

func (*Builder) At

func (b *Builder) At(uin ...int64) IMsg

func (*Builder) BuildStringBody

func (b *Builder) BuildStringBody() (string, error)

func (*Builder) Buttons

func (b *Builder) Buttons(keys ...*Button) IMsg

func (*Builder) Do

func (b *Builder) Do(ctx context.Context) error

func (*Builder) DoAndResponse

func (b *Builder) DoAndResponse(ctx context.Context) (*Response, error)

func (*Builder) DoUpload

func (b *Builder) DoUpload(ctx context.Context) (*File, error)

func (*Builder) DoWithCallBack

func (b *Builder) DoWithCallBack(ctx context.Context, callBack func(response *Response, err error)) error

func (*Builder) FriendManager

func (b *Builder) FriendManager() IFriendManager

func (*Builder) FriendMsg

func (b *Builder) FriendMsg() IMsg

func (*Builder) FriendPic

func (b *Builder) FriendPic() IUpload

func (*Builder) FriendVoice

func (b *Builder) FriendVoice() IUpload

func (*Builder) GetClusterInfo

func (b *Builder) GetClusterInfo() DoApi

func (*Builder) GetFriendLists

func (b *Builder) GetFriendLists(LastUin int64) IFriendManager

func (*Builder) GetGroupLists

func (b *Builder) GetGroupLists() IGroupManager

func (*Builder) GetGroupMemberLists

func (b *Builder) GetGroupMemberLists(uin int64, lastBuffer string) IGroupManager

func (*Builder) GroupManager

func (b *Builder) GroupManager() IGroupManager

func (*Builder) GroupMsg

func (b *Builder) GroupMsg() IMsg

func (*Builder) GroupPic

func (b *Builder) GroupPic() IUpload

func (*Builder) GroupSystemMsgAction

func (b *Builder) GroupSystemMsgAction(MsgType int, MsgSeq, GroupCode int64) IGroupSystemMsgAction

func (*Builder) GroupVoice

func (b *Builder) GroupVoice() IUpload

func (*Builder) JsonMsg

func (b *Builder) JsonMsg(json string) IMsg

func (*Builder) MarkDownMsg

func (b *Builder) MarkDownMsg(md string) IMsg

func (*Builder) MsgRandom

func (b *Builder) MsgRandom(MsgRandom int64) IGroupManager

func (*Builder) MsgSeq

func (b *Builder) MsgSeq(MsgSeq int64) IGroupManager

func (*Builder) MultiMsg

func (b *Builder) MultiMsg(msgBodys ...*MsgBody) IMsg

func (*Builder) OpAccept

func (b *Builder) OpAccept() IGroupSystemMsgAction

func (*Builder) OpIgnore

func (b *Builder) OpIgnore() IGroupSystemMsgAction

func (*Builder) OpReject

func (b *Builder) OpReject() IGroupSystemMsgAction

func (*Builder) Pat

func (b *Builder) Pat(Uin int64) IGroupManager

func (*Builder) PicMsg

func (b *Builder) PicMsg(pics ...*File) IMsg

func (*Builder) ProhibitedUser

func (b *Builder) ProhibitedUser() IGroupManager

func (*Builder) Qrcode

func (b *Builder) Qrcode() IQrcode

func (*Builder) QueryUin

func (b *Builder) QueryUin() IQueryUin

func (*Builder) RemoveUser

func (b *Builder) RemoveUser() IGroupManager

func (*Builder) RenameUserNickName

func (b *Builder) RenameUserNickName(NickName string) IGroupManager

func (*Builder) ReplyMsg

func (b *Builder) ReplyMsg(MsgSeq, MsgUid int64) IMsg

func (*Builder) RevokeMsg

func (b *Builder) RevokeMsg() IGroupManager

func (*Builder) SendMsg

func (b *Builder) SendMsg() ISendMsg

func (*Builder) SetBase64Buf

func (b *Builder) SetBase64Buf(base64Buf string) IUpload

func (*Builder) SetFilePath

func (b *Builder) SetFilePath(path string) IUpload

func (*Builder) SetFileUrlPath

func (b *Builder) SetFileUrlPath(url string) IUpload

func (*Builder) SetUin

func (b *Builder) SetUin(uid string)

func (*Builder) ShutTime

func (b *Builder) ShutTime(ShutTime int) IGroupManager

func (*Builder) TextMsg

func (b *Builder) TextMsg(text string) IMsg

func (*Builder) ToGUin

func (b *Builder) ToGUin(Uin int64) IGroupManager

func (*Builder) ToGroupCode

func (b *Builder) ToGroupCode(GroupCode int64) IGroupManager

func (*Builder) ToUid

func (b *Builder) ToUid(Uid string) IGroupManager

func (*Builder) ToUin

func (b *Builder) ToUin(uin int64) IMsg

func (*Builder) Upload

func (b *Builder) Upload() IUpload

func (*Builder) VoiceMsg

func (b *Builder) VoiceMsg(voice *File) IMsg

func (*Builder) XmlMsg

func (b *Builder) XmlMsg(xml string) IMsg

type Button

type Button struct {
	ID                     string `json:"Id"`
	RenderDataLabel        string `json:"RenderDataLabel"`
	RenderDataVisitedLabel string `json:"RenderDataVisitedLabel"`
	RenderDataStyle        int    `json:"RenderDataStyle"`
	ActionType             int    `json:"ActionType"`
	ActionPermissonType    int    `json:"ActionPermissonType"`
	ActionData             string `json:"ActionData"`
	ActionUnsupportTips    string `json:"ActionUnsupportTips"`
}

type CgiRequest

type CgiRequest struct {
	LastUin    *int64                  `json:"LastUin,omitempty"`
	OpCode     *int                    `json:"OpCode,omitempty"`
	MsgSeq     *int64                  `json:"MsgSeq,omitempty"`
	MsgType    *int                    `json:"MsgType,omitempty"`
	GroupCode  *int64                  `json:"GroupCode,omitempty"`
	Uin        *int64                  `json:"Uin,omitempty"`
	LastBuffer *string                 `json:"LastBuffer,omitempty"`
	CommandId  *int                    `json:"CommandId,omitempty"`
	FilePath   *string                 `json:"FilePath,omitempty"`
	Base64Buf  *string                 `json:"Base64Buf,omitempty"`
	FileUrl    *string                 `json:"FileUrl,omitempty"`
	ToUin      *int64                  `json:"ToUin,omitempty"`
	ToType     *int                    `json:"ToType,omitempty"`
	Content    *string                 `json:"Content,omitempty"`
	SubMsgType *int                    `json:"SubMsgType,omitempty"`
	MsgBodys   []*MsgBody              `json:"MsgBodys,omitempty"`
	Images     []*File                 `json:"Images,omitempty"`
	Voice      *File                   `json:"Voice,omitempty"`
	Markdown   *string                 `json:"Markdown,omitempty"`
	Keyboard   []*map[string][]*Button `json:"Keyboard,omitempty"`
	Uid        *string                 `json:"Uid,omitempty"`
	MsgRandom  *int64                  `json:"MsgRandom,omitempty"`
	BanTime    *int                    `json:"BanTime,omitempty"`
	Nick       *string                 `json:"Nick,omitempty"`
	AtUinLists []struct {
		Uin *int64 `json:"Uin,omitempty"`
	} `json:"AtUinLists,omitempty"`
	ReplyTo *struct {
		MsgSeq *int64 `json:"MsgSeq,omitempty"`
		MsgUid *int64 `json:"MsgUid,omitempty"`
	} `json:"ReplyTo,omitempty"`
}

type ClusterInfo

type ClusterInfo struct {
	Alloc        string `json:"Alloc"`
	ClientId     string `json:"ClientId"`
	ClusterIP    string `json:"ClusterIP"`
	CpuNum       int    `json:"CpuNum"`
	FreesTimes   int    `json:"FreesTimes"`
	GCTime       string `json:"GCTime"`
	GoArch       string `json:"GoArch"`
	GoVersion    string `json:"GoVersion"`
	GoroutineNum int    `json:"GoroutineNum"`
	LastGCTime   string `json:"LastGCTime"`
	MacInfo      string `json:"MacInfo"`
	MallocsTimes int    `json:"MallocsTimes"`
	NextGC       string `json:"NextGC"`
	Platform     string `json:"Platform"`
	QQUsers      []struct {
		MoneyCount    string `json:"MoneyCount"`
		OnlieTime     string `json:"OnlieTime"`
		QQ            string `json:"QQ"`
		ReceiveCount  int    `json:"ReceiveCount"`
		SendCount     int    `json:"SendCount"`
		TotalMoney    string `json:"TotalMoney"`
		TotalRecv     string `json:"TotalRecv"`
		TotalSend     string `json:"TotalSend"`
		UserLevelInfo string `json:"UserLevelInfo"`
	} `json:"QQUsers"`
	QQUsersCounts int    `json:"QQUsersCounts"`
	ServerRuntime string `json:"ServerRuntime"`
	Sys           string `json:"Sys"`
	TotalAlloc    string `json:"TotalAlloc"`
	Version       string `json:"Version"`
}

type DoApi

type DoApi interface {
	Do(ctx context.Context) error
	DoWithCallBack(ctx context.Context, callBack func(response *Response, err error)) error
	DoAndResponse(ctx context.Context) (*Response, error)
}

type File

type File struct {
	FileMd5   string `json:"FileMd5"`
	FileSize  int    `json:"FileSize"`
	FileToken string `json:"FileToken"`
	FileId    int64  `json:"FileId"`
	Height    int    `json:"Height"`
	Width     int    `json:"Width"`
	Url       string `json:"Url"`
}

type FriendLists

type FriendLists struct {
	FriendLists []struct {
		Head      string `json:"Head"`
		Signature string `json:"Signature"`
		TagId     int    `json:"TagId"`
		Uid       string `json:"Uid"`
		Uin       int    `json:"Uin"`
		Nick      string `json:"Nick"`
		Sex       int    `json:"Sex"`
	} `json:"FriendLists"`
	LastBuffer string `json:"LastBuffer"`
	TagLists   []struct {
		TagId   int    `json:"TagId"`
		TagName string `json:"TagName"`
	} `json:"TagLists"`
}

type GroupLists

type GroupLists struct {
	GroupLists []struct {
		CreateTime int    `json:"CreateTime"`
		GroupCnt   int    `json:"GroupCnt"`
		GroupCode  int    `json:"GroupCode"`
		GroupName  string `json:"GroupName"`
		MemberCnt  int    `json:"MemberCnt"`
	} `json:"GroupLists"`
}

type GroupMemberLists

type GroupMemberLists struct {
	LastBuffer  string `json:"LastBuffer"`
	MemberLists []struct {
		CreditLevel   int    `json:"CreditLevel"`
		JoinTime      int    `json:"JoinTime"`
		LastSpeakTime int    `json:"LastSpeakTime"`
		Level         int    `json:"Level"`
		MemberFlag    int    `json:"MemberFlag"`
		Nick          string `json:"Nick"`
		Uid           string `json:"Uid"`
		Uin           int    `json:"Uin"`
	} `json:"MemberLists"`
}

type GroupMessageResponse

type GroupMessageResponse struct {
	MsgSeq  int64 `json:"MsgSeq"`
	MsgTime int64 `json:"MsgTime"`
}

type IFriendManager

type IFriendManager interface {
	DoApi
	GetFriendLists(LastUin int64) IFriendManager
}

type IGroupManager

type IGroupManager interface {
	DoApi
	GetGroupLists() IGroupManager
	GetGroupMemberLists(uin int64, lastBuffer string) IGroupManager
	GroupSystemMsgAction(MsgType int, MsgSeq, GroupCode int64) IGroupSystemMsgAction
	RevokeMsg() IGroupManager
	ToGUin(Uin int64) IGroupManager
	ToGroupCode(Uin int64) IGroupManager
	MsgSeq(MsgSeq int64) IGroupManager
	MsgRandom(MsgRandom int64) IGroupManager
	ProhibitedUser() IGroupManager
	ToUid(Uid string) IGroupManager
	ShutTime(ShutTime int) IGroupManager
	RemoveUser() IGroupManager
	RenameUserNickName(NickName string) IGroupManager
	Pat(Uin int64) IGroupManager
}

type IGroupSystemMsgAction

type IGroupSystemMsgAction interface {
	DoApi
	OpAccept() IGroupSystemMsgAction
	OpReject() IGroupSystemMsgAction
	OpIgnore() IGroupSystemMsgAction
}

type IMainFunc

type IMainFunc interface {
	SendMsg() ISendMsg
	QueryUin() IQueryUin
	Qrcode() IQrcode
	Upload() IUpload
	GetClusterInfo() DoApi
	GroupManager() IGroupManager
	FriendManager() IFriendManager
}

func New

func New(url string, botQQ int64) IMainFunc

type IMsg

type IMsg interface {
	ToUin(uin int64) IMsg
	TextMsg(text string) IMsg
	ReplyMsg(MsgSeq, MsgUid int64) IMsg
	PicMsg(...*File) IMsg
	VoiceMsg(voice *File) IMsg
	XmlMsg(xml string) IMsg
	JsonMsg(json string) IMsg
	MultiMsg(msgBody ...*MsgBody) IMsg
	MarkDownMsg(text string) IMsg
	At(uint ...int64) IMsg
	Buttons(keys ...*Button) IMsg
	DoApi
}

type IQrcode

type IQrcode interface {
	Get() error
	GetUrl() *string
	PrintTerminal(io.Writer) error
	GetImageBytes() []byte
}

type IQueryUin

type IQueryUin interface {
	DoApi
	SetUin(uid string)
}

type ISendMsg

type ISendMsg interface {
	FriendMsg() IMsg
	GroupMsg() IMsg
}

type IUpload

type IUpload interface {
	SetFilePath(path string) IUpload
	SetFileUrlPath(url string) IUpload
	SetBase64Buf(base64Buf string) IUpload
	FriendPic() IUpload
	FriendVoice() IUpload
	GroupVoice() IUpload
	GroupPic() IUpload
	DoUpload(ctx context.Context) (*File, error)
}

type MsgBody

type MsgBody struct {
	Content *string `json:"Content,omitempty"`
	Image   *File   `json:"Image,omitempty"`
}

type QrcodeStruct

type QrcodeStruct struct {
	// contains filtered or unexported fields
}

func (*QrcodeStruct) Get

func (q *QrcodeStruct) Get() error

func (*QrcodeStruct) GetImageBytes

func (q *QrcodeStruct) GetImageBytes() []byte

func (*QrcodeStruct) GetUrl

func (q *QrcodeStruct) GetUrl() *string

func (*QrcodeStruct) PrintTerminal

func (q *QrcodeStruct) PrintTerminal(writer io.Writer) error

type QueryUinStruct

type QueryUinStruct struct {
	Uin       int    `json:"Uin"`
	Uid       string `json:"Uid"`
	Nick      string `json:"Nick"`
	Head      string `json:"Head"`
	Signature string `json:"Signature"`
	Sex       int    `json:"Sex"`
	Level     int    `json:"Level"`
}

type Response

type Response struct {
	// contains filtered or unexported fields
}

func NewResponse

func NewResponse(msg []byte) *Response

func (*Response) ErrorMsg

func (r *Response) ErrorMsg() string

func (*Response) GetData

func (r *Response) GetData(data interface{}) error

func (*Response) GetGroupMessageResponse

func (r *Response) GetGroupMessageResponse() (*GroupMessageResponse, error)

func (*Response) GetOrigin

func (r *Response) GetOrigin() []byte

func (*Response) Ok

func (r *Response) Ok() bool

func (*Response) Result

func (r *Response) Result() (Ret int, ErrMsg string)

type ResponseStruct

type ResponseStruct struct {
	CgiBaseResponse struct {
		Ret    int    `json:"Ret"`
		ErrMsg string `json:"ErrMsg"`
	} `json:"CgiBaseResponse"`
	ResponseData json.RawMessage `json:"ResponseData,omitempty"`
	Data         interface{}     `json:"Data"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL