api

package
v0.0.0-...-2d6c13f Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CheckLoginUrl = iota
	UserInfoUrl
	SendTextMsgUrl
	SendAtTextUrl
	SendImagesMsgUrl
	SendFileMsgUrl
	SendCustomEmotionUrl
	SendAppletUrl
	SendPatMsgUrl
	SearchFriend
	FriendRequest
	ConfirmFriendRequest
	OcrUrl
	ForwardMsgUrl
	HookSyncMsgUrl
	UnHookSyncMsgUrl
	HookAudioMsgUrl
	UnHookAudioMsgUrl
	GetContactListUrl
	GetContactProfileUrl
	GetContactNicknameUrl

	//转账相关
	ConfirmTransfer

	// db操作
	GetDBInfoUrl
	ExecSqlUrl

	// 公众号相关
	ForwardPublicMsgByMsgIdUrl
	ForwardPublicMsgUrl

	// 群操作
	GetChatRoomDetailInfoUrl
	GetMemberFromChatRoomUrl
	GetNicknameFromChatRoomUrl
	AddMemberToChatRoomUrl
	ModifyNicknameUrl
	DelMemberFromChatRoomUrl
	TopMsgUrl
	RemoveTopMsgUrl
	InviteMemberToChatRoomUrl

	// 朋友圈相关,朋友圈首页,前置条件需先调用hook消息接口成功,具体内容会在hook消息里返回,格式如下:
	/**
	  {
		  "data":[
			  {
				  "content": "",
				  "createTime': 1691125287,
				  "senderId': "",
				  "snsId': 123,
				  "xml':""
			  }
		  ]
	  }
	*/
	GetSNSFirstPageUrl
	GetSNSNextPageUrl

	// 收藏相关
	AddFavFromMsgUrl
	AddFavFromImageUrl

	// 附件相关
	DownloadAttachUrl
	DecodeImageUrl
	GetVoiceByMsgIdUrl
)

Variables

View Source
var (
	ErrMethodNotImplement = errors.New("方法未实现")
)

Functions

This section is empty.

Types

type Api

type Api struct {
	BaseUrl           string
	ApiVersion        ApiVersion
	MsgListenInstance *MsgListenServer
}

func NewApi

func NewApi(apiVersion ApiVersion, baseUrl string) *Api

func (*Api) AddFavFromImage

func (api *Api) AddFavFromImage(wxId string, imagePath string) error

func (*Api) AddFavFromMsg

func (api *Api) AddFavFromMsg(msgId string) error

func (*Api) AddMemberToChatRoom

func (api *Api) AddMemberToChatRoom(chatRoomId string, members ...string) error

func (*Api) CheckLogin

func (api *Api) CheckLogin() (bool, error)

func (*Api) Close

func (api *Api) Close() error

func (*Api) ConfirmFriendRequest

func (api *Api) ConfirmFriendRequest(encryptUsername, ticket string, permission int) error

ConfirmFriendRequest permission 好友权限,0.全部 8.仅聊天。(好友超过5000人后,会验证权限,传8即可)

func (*Api) DecodeImage

func (api *Api) DecodeImage(src, storeDir string) error

func (*Api) DelMemberFromChatRoom

func (api *Api) DelMemberFromChatRoom(chatRoomId string, members ...string) error

func (*Api) DownloadAttach

func (api *Api) DownloadAttach(msgId string) error

下载附件,保存在微信文件目录下 wxid_xxx/wxhelper 目录下

func (*Api) ExecSql

func (api *Api) ExecSql(dbHandle int64, sql string) ([][]string, error)

func (*Api) ForwardMsg

func (api *Api) ForwardMsg(wxid, msgId string) error

func (*Api) ForwardPublicMsg

func (api *Api) ForwardPublicMsg(appName, userName, title, url, thumbUrl, digest, wxid string) error

appName string 公众号id,消息内容里的appname userName string 公众号昵称,消息内容里的username title string 链接地址,消息内容里的title url string 链接地址,消息内容里的url thumbUrl string 缩略图地址,消息内容里的thumburl digest string 摘要,消息内容里的digest wxid string wxid

func (*Api) ForwardPublicMsgByMsgId

func (api *Api) ForwardPublicMsgByMsgId(wxId string, msgId string) error

func (*Api) GetAvatars

func (api *Api) GetAvatars(wxids []string) (map[string]string, error)

func (*Api) GetChatRoomDetailInfo

func (api *Api) GetChatRoomDetailInfo(chatRoomId string) (*proto.ChatroomDetail, error)

GetChatRoomDetailInfoUrl param chatRoomId: "12222@chatroom"

func (*Api) GetContactList

func (api *Api) GetContactList() ([]proto.ContactInfo, error)

func (*Api) GetContactNickname

func (api *Api) GetContactNickname(wxidOrGroupId string) (string, error)

func (*Api) GetContactProfile

func (api *Api) GetContactProfile(wxid string) (*proto.ContactProfile, error)

func (*Api) GetDBInfo

func (api *Api) GetDBInfo() ([]*proto.DbInfo, error)

func (*Api) GetMemberFromChatRoom

func (api *Api) GetMemberFromChatRoom(chatRoomId string, decryptNickname bool) (*proto.ChatroomMember, error)

func (*Api) GetNicknameFromChatRoom

func (api *Api) GetNicknameFromChatRoom(chatRoomId, memberId string) (string, error)

func (*Api) GetSNSNextPage

func (api *Api) GetSNSNextPage() error

func (*Api) GetSnsFirstPage

func (api *Api) GetSnsFirstPage() error

func (*Api) GetUserInfo

func (api *Api) GetUserInfo() (*proto.WxUserInfo, error)

func (*Api) GetVoiceByMsgId

func (api *Api) GetVoiceByMsgId(msgId, storeDir string) error

func (*Api) HookMsg

func (api *Api) HookMsg(port int) error

func (*Api) InviteMemberToChatRoom

func (api *Api) InviteMemberToChatRoom(chatRoomId string, members ...string) error

func (*Api) ModifyChatroomNickname

func (api *Api) ModifyChatroomNickname(chatRoomId, wxid, nickName string) error

func (*Api) Ocr

func (api *Api) Ocr(imagePath string) (string, error)

func (*Api) RemoveTopMsg

func (api *Api) RemoveTopMsg(chatRoomId, msgId string) error

func (*Api) SendApplet

func (api *Api) SendApplet(req *proto.SendAppletMsgReq) error

发送小程序(待完善,不稳定),相关参数可以参考示例的滴滴小程序的内容自行组装。

func (*Api) SendAtAllText

func (api *Api) SendAtAllText(chatRoomId string, msg string) error

func (*Api) SendAtText

func (api *Api) SendAtText(chatRoomId string, msg string, wxids ...string) error

func (*Api) SendCustomEmotion

func (api *Api) SendCustomEmotion(wxid, filePath string) error

表情路径,可以直接查询CustomEmotion表的MD5字段 "filePath":"C:\\wechatDir\\WeChat Files\\wxid_123\\FileStorage\\CustomEmotion\\8F\\8F6423BC2E69188DCAC797E279C81DE9"

func (*Api) SendFileMsg

func (api *Api) SendFileMsg(wxid, filePath string) error

func (*Api) SendImagesMsg

func (api *Api) SendImagesMsg(wxid, imagePath string) error

func (*Api) SendPatMsg

func (api *Api) SendPatMsg(wxid string, receiver string) error

wxid string 被拍人id receiver string 接收人id,可以是自己wxid,私聊好友wxid,群id

func (*Api) SendTextMsg

func (api *Api) SendTextMsg(wxid, msg string) error

func (*Api) SetMsgCallback

func (api *Api) SetMsgCallback(callback func(bs []byte)) error

func (*Api) TopMsg

func (api *Api) TopMsg(msgId string) error

func (*Api) UnHookMsg

func (api *Api) UnHookMsg() error

type ApiUrl

type ApiUrl int

type ApiVersion

type ApiVersion int
const (
	ApiVersionV1 ApiVersion = 1
	ApiVersionV2 ApiVersion = 2
)

type MsgListenServer

type MsgListenServer struct {
	Lock        sync.Mutex
	Port        int
	Listener    net.Listener
	HookSuccess bool
	Callback    func(bs []byte)
	MsgChannel  chan []byte
	IsClosed    bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳