Documentation
¶
Index ¶
- Constants
- Variables
- func GetLoginAvatar(resp string) (string, error)
- func GetRandomStringFromNum(length int) string
- func JsLogin(common *Common) (string, error)
- func Login(common *Common, uuid, tip string) (string, error)
- func QrCode(common *Common, uuid string) ([]byte, error)
- func ReadSessionData(path string) map[string]*Session
- func RealTargetUserName(session *Session, msg *ReceivedMessage) string
- func SyncCheck(common *Common, ce *XmlConfig, cookies []*http.Cookie, server string, ...) (int, int, error)
- func WebNewLoginPage(common *Common, xc *XmlConfig, uri string) ([]*http.Cookie, error)
- func WebWxBatchGetContact(common *Common, ce *XmlConfig, cookies []*http.Cookie, cl []*User) ([]byte, error)
- func WebWxCreateChatroom(common *Common, ce *XmlConfig, cookies []*http.Cookie, users []*User, ...) (interface{}, error)
- func WebWxGetContact(common *Common, ce *XmlConfig, cookies []*http.Cookie) ([]byte, error)
- func WebWxGetIcon(common *Common, ce *XmlConfig, cookies []*http.Cookie, ...) ([]byte, error)
- func WebWxGetIconByHeadImgUrl(common *Common, ce *XmlConfig, cookies []*http.Cookie, headImgUrl string) ([]byte, error)
- func WebWxGetMsgImg(common *Common, ce *XmlConfig, cookies []*http.Cookie, msgId string) ([]byte, error)
- func WebWxInit(common *Common, ce *XmlConfig) ([]byte, error)
- func WebWxLogout(common *Common, ce *XmlConfig, cookies []*http.Cookie) error
- func WebWxRevokeMsg(common *Common, ce *XmlConfig, cookies []*http.Cookie, ...) error
- func WebWxSendEmoticon(common *Common, ce *XmlConfig, cookies []*http.Cookie, from, to, media string) (int, error)
- func WebWxSendMsg(common *Common, ce *XmlConfig, cookies []*http.Cookie, from, to string, ...) ([]byte, error)
- func WebWxSendMsgImg(common *Common, ce *XmlConfig, cookies []*http.Cookie, from, to, media string) (int, error)
- func WebWxStatusNotify(common *Common, ce *XmlConfig, bot *User) (int, error)
- func WebWxSync(common *Common, ce *XmlConfig, cookies []*http.Cookie, msg chan []byte, ...) ([]*http.Cookie, error)
- func WebWxSyncFlushCookie(common *Common, ce *XmlConfig, cookies []*http.Cookie, skl *SyncKeyList) ([]*http.Cookie, error)
- func WebWxUploadMedia(common *Common, ce *XmlConfig, cookies []*http.Cookie, filename string, ...) (string, error)
- func WebWxVerifyUser(common *Common, ce *XmlConfig, cookies []*http.Cookie, opcode int, ...) ([]byte, error)
- func WriteSessionData(multiSession map[string]*Session, path string)
- type ApiV2
- func (api *ApiV2) JsLogin(common *Common) (string, error)
- func (api *ApiV2) Login(common *Common, uuid, tip string) (string, error)
- func (api *ApiV2) QrCode(common *Common, uuid string) ([]byte, error)
- func (api *ApiV2) SyncCheck(common *Common, ce *XmlConfig, cookies []*http.Cookie, server string, ...) (retcode int, selector int, err error)
- func (api *ApiV2) WebNewLoginPage(common *Common, xc *XmlConfig, uri string) ([]*http.Cookie, error)
- func (api *ApiV2) WebWxBatchGetContact(common *Common, ce *XmlConfig, cookies []*http.Cookie, cl []*User) ([]byte, error)
- func (api *ApiV2) WebWxCreateChatroom(common *Common, ce *XmlConfig, cookies []*http.Cookie, users []*User, ...) (interface{}, error)
- func (api *ApiV2) WebWxGetContact(common *Common, ce *XmlConfig, cookies []*http.Cookie) ([]byte, error)
- func (api *ApiV2) WebWxGetIcon(common *Common, ce *XmlConfig, cookies []*http.Cookie, ...) ([]byte, error)
- func (api *ApiV2) WebWxGetIconByHeadImgUrl(common *Common, ce *XmlConfig, cookies []*http.Cookie, headImgUrl string) ([]byte, error)
- func (api *ApiV2) WebWxGetMsgImg(common *Common, ce *XmlConfig, cookies []*http.Cookie, msgId string) ([]byte, error)
- func (api *ApiV2) WebWxInit(common *Common, ce *XmlConfig) ([]byte, error)
- func (api *ApiV2) WebWxLogout(common *Common, ce *XmlConfig, cookies []*http.Cookie) error
- func (api *ApiV2) WebWxRevokeMsg(common *Common, ce *XmlConfig, cookies []*http.Cookie, ...) error
- func (api *ApiV2) WebWxSendEmoticon(common *Common, ce *XmlConfig, cookies []*http.Cookie, from, to, media string) (int, error)
- func (api *ApiV2) WebWxSendMsg(common *Common, ce *XmlConfig, cookies []*http.Cookie, from, to string, ...) ([]byte, error)
- func (api *ApiV2) WebWxSendMsgImg(common *Common, ce *XmlConfig, cookies []*http.Cookie, from, to, media string) (int, error)
- func (api *ApiV2) WebWxStatusNotify(common *Common, ce *XmlConfig, bot *User) (int, error)
- func (api *ApiV2) WebWxSync(common *Common, ce *XmlConfig, cookies []*http.Cookie, msg chan []byte, ...) ([]*http.Cookie, error)
- func (api *ApiV2) WebWxSyncFlushCookie(common *Common, ce *XmlConfig, cookies []*http.Cookie, skl *SyncKeyList) ([]*http.Cookie, error)
- func (api *ApiV2) WebWxUploadMedia(common *Common, ce *XmlConfig, cookies []*http.Cookie, filename string, ...) (string, error)
- func (api *ApiV2) WebWxVerifyUser(common *Common, ce *XmlConfig, cookies []*http.Cookie, opcode int, ...) ([]byte, error)
- func (a *ApiV2) WxUpdateChatroom(common *Common, ce *XmlConfig, cookies []*http.Cookie, ...)
- type BaseRequest
- type BaseResponse
- type ChatroomReqBody
- type Client
- func (c *Client) Get(url string, data *url.Values) ([]byte, error)
- func (c *Client) GetByte(url string, data []byte) ([]byte, error)
- func (c *Client) GetWithHeader(url string, heder Header) ([]byte, error)
- func (c *Client) Post(url string, data *url.Values) ([]byte, error)
- func (c *Client) PostJson(url string, m map[string]interface{}) ([]byte, error)
- func (c *Client) PostJsonByte(url string, json []byte) ([]byte, error)
- func (c *Client) PostJsonByteForResp(url string, json []byte) (*http.Response, []byte, error)
- func (c *Client) SetJar(jar http.CookieJar)
- type Common
- type ContactManager
- func (s *ContactManager) AddUser(user *User)
- func (s *ContactManager) AddUserFromBytes(cb []byte) error
- func (s *ContactManager) GetAll() []*User
- func (s *ContactManager) GetContactByPYQuanPin(sig string) *User
- func (s *ContactManager) GetContactByUserName(un string) *User
- func (s *ContactManager) GetContactsByName(sig string) []*User
- func (s *ContactManager) GetGroupContacts() []*User
- func (s *ContactManager) GetStrangers() []*User
- type EmotionMessage
- type Handler
- type HandlerRegister
- func (hr *HandlerRegister) Add(key int, h Handler, name string) error
- func (hr *HandlerRegister) DisableByName(name string) error
- func (hr *HandlerRegister) DisableByType(key int) error
- func (hr *HandlerRegister) Dump() string
- func (hr *HandlerRegister) EnableByName(name string) error
- func (hr *HandlerRegister) EnableByType(key int) error
- func (hr *HandlerRegister) Get(key int) (error, []*HandlerWrapper)
- func (hr *HandlerRegister) GetAll() []*HandlerWrapper
- type HandlerWrapper
- type Header
- type InitReqBody
- type LogoutReqBody
- type MediaMessage
- type MemberManager
- type PSession
- type ReceivedMessage
- type RecommendInfo
- type RevokeReqBody
- type Session
- func (s *Session) AcceptFriend(verifyContent string, vul []*VerifyUser) error
- func (s *Session) After(duration time.Duration) *Session
- func (s *Session) At(d time.Time) *Session
- func (s *Session) GetCookies() []*http.Cookie
- func (s *Session) GetImg(msgId string) ([]byte, error)
- func (s *Session) LoginAndServe(useCache bool) error
- func (s *Session) Logout() error
- func (s *Session) RevokeMsg(clientMsgId, svrMsgId, toUserName string)
- func (s *Session) SendEmotionFromBytes(b []byte, from, to string)
- func (s *Session) SendEmotionFromPath(path, from, to string)
- func (s *Session) SendImg(path, from, to string)
- func (s *Session) SendImgFromBytes(b []byte, path, from, to string)
- func (s *Session) SendText(msg, from, to string) (string, string, error)
- func (s *Session) SetAfterLogin(f func() error)
- func (s *Session) SetCookies(cookies []*http.Cookie)
- func (s *Session) SetOnLoginAvatar(f func(avatar string) error)
- type SyncKey
- type SyncKeyList
- type TextMessage
- type UrlGroup
- type User
- type VerifyUser
- type WxWebBatchGetContactResponse
- type WxWebGetContactResponse
- type XmlConfig
Constants ¶
const ( // msg types MSG_TEXT = 1 // text message MSG_IMG = 3 // image message MSG_VOICE = 34 // voice message MSG_FV = 37 // friend verification message MSG_PF = 40 // POSSIBLEFRIEND_MSG MSG_SCC = 42 // shared contact card MSG_VIDEO = 43 // video message MSG_EMOTION = 47 // gif MSG_LOCATION = 48 // location message MSG_LINK = 49 // shared link message MSG_VOIP = 50 // VOIPMSG MSG_INIT = 51 // wechat init message MSG_VOIPNOTIFY = 52 // VOIPNOTIFY MSG_VOIPINVITE = 53 // VOIPINVITE MSG_SHORT_VIDEO = 62 // short video message MSG_SYSNOTICE = 9999 // SYSNOTICE MSG_SYS = 10000 // system message MSG_WITHDRAW = 10002 // withdraw notification message )
const ( // WEB_MODE: in this mode CreateSession will return a QRCode image url WEB_MODE = iota + 1 // MINAL_MODE: CreateSession will output qrcode in terminal TERMINAL_MODE BACKGROUND_MODE TERMINAL_MODE_GOLAND )
Variables ¶
var ( // DefaultCommon: default session config DefaultCommon = &Common{ AppId: "wx782c26e4c19acffb", LoginUrl: "https://login.weixin.qq.com", Lang: "zh_CN", DeviceID: "e" + GetRandomStringFromNum(15), UserAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109 Safari/537.36", SyncSrv: "webpush.wx.qq.com", UploadUrl: "https://file.wx.qq.com/cgi-bin/mmwebwx-bin/webwxuploadmedia?f=json", MediaCount: 0, } URLPool = []UrlGroup{ {"wx2.qq.com", "file.wx2.qq.com", "webpush.wx2.qq.com"}, {"wx8.qq.com", "file.wx8.qq.com", "webpush.wx8.qq.com"}, {"qq.com", "file.wx.qq.com", "webpush.wx.qq.com"}, {"web2.wechat.com", "file.web2.wechat.com", "webpush.web2.wechat.com"}, {"wechat.com", "file.web.wechat.com", "webpush.web.wechat.com"}, } LogoutSign = make(map[int]int) )
var ( // SpecialContact: special contacts map SpecialContact = map[string]bool{ "filehelper": true, "newsapp": true, "fmessage": true, "weibo": true, "qqmail": true, "tmessage": true, "qmessage": true, "qqsync": true, "floatbottle": true, "lbsapp": true, "shakeapp": true, "medianote": true, "qqfriend": true, "readerapp": true, "blogapp": true, "facebookapp": true, "masssendapp": true, "meishiapp": true, "feedsapp": true, "voip": true, "blogappweixin": true, "weixin": true, "brandsessionholder": true, "weixinreminder": true, "officialaccounts": true, "wxitil": true, "userexperience_alarm": true, "notification_messages": true, } )
Functions ¶
func GetLoginAvatar ¶
func GetRandomStringFromNum ¶
func ReadSessionData ¶
func RealTargetUserName ¶
func RealTargetUserName(session *Session, msg *ReceivedMessage) string
func SyncCheck ¶
func SyncCheck(common *Common, ce *XmlConfig, cookies []*http.Cookie, server string, skl *SyncKeyList) (int, int, error)
SyncCheck: synccheck api
func WebNewLoginPage ¶
WebNewLoginPage: webwxnewloginpage api
func WebWxBatchGetContact ¶
func WebWxBatchGetContact(common *Common, ce *XmlConfig, cookies []*http.Cookie, cl []*User) ([]byte, error)
WebWxBatchGetContact: webwxbatchgetcontact api
func WebWxCreateChatroom ¶
func WebWxCreateChatroom(common *Common, ce *XmlConfig, cookies []*http.Cookie, users []*User, topic string) (interface{}, error)
WebWxCreateChatroom: webwxcreatechatroom api
func WebWxGetContact ¶
WebWxGetContact: webwxgetcontact api
func WebWxGetIcon ¶
func WebWxGetIcon(common *Common, ce *XmlConfig, cookies []*http.Cookie, username, chatroomid string) ([]byte, error)
WebWxGetIcon: webwxgeticon api
func WebWxGetIconByHeadImgUrl ¶
func WebWxGetIconByHeadImgUrl(common *Common, ce *XmlConfig, cookies []*http.Cookie, headImgUrl string) ([]byte, error)
WebWxGetIconByHeadImgUrl: get head img
func WebWxGetMsgImg ¶
func WebWxGetMsgImg(common *Common, ce *XmlConfig, cookies []*http.Cookie, msgId string) ([]byte, error)
WebWxGetMsgImg: webwxgetmsgimg api
func WebWxLogout ¶
WebWxlogout: webwxlogout api
func WebWxRevokeMsg ¶
func WebWxRevokeMsg(common *Common, ce *XmlConfig, cookies []*http.Cookie, clientMsgId, svrMsgId, toUserName string) error
WebWxRevokeMsg: webwxrevokemsg api
func WebWxSendEmoticon ¶
func WebWxSendEmoticon(common *Common, ce *XmlConfig, cookies []*http.Cookie, from, to, media string) (int, error)
WebWxSendEmoticon: webwxsendemoticon api
func WebWxSendMsg ¶
func WebWxSendMsg(common *Common, ce *XmlConfig, cookies []*http.Cookie, from, to string, msg string) ([]byte, error)
WebWxSendMsg: webwxsendmsg api
func WebWxSendMsgImg ¶
func WebWxSendMsgImg(common *Common, ce *XmlConfig, cookies []*http.Cookie, from, to, media string) (int, error)
WebWxSendMsgImg: webwxsendmsgimg api
func WebWxStatusNotify ¶
WebWxStatusNotify: webwxstatusnotify api
func WebWxSync ¶
func WebWxSync(common *Common, ce *XmlConfig, cookies []*http.Cookie, msg chan []byte, skl *SyncKeyList) ([]*http.Cookie, error)
WebWxSync: webwxsync api
func WebWxSyncFlushCookie ¶
func WebWxUploadMedia ¶
func WebWxUploadMedia(common *Common, ce *XmlConfig, cookies []*http.Cookie, filename string, content []byte) (string, error)
WebWxUploadMedia: webwxuploadmedia api
func WebWxVerifyUser ¶
func WebWxVerifyUser(common *Common, ce *XmlConfig, cookies []*http.Cookie, opcode int, verifyContent string, vul []*VerifyUser) ([]byte, error)
WebWxVerifyUser: webwxverifyuser api
func WriteSessionData ¶
Types ¶
type ApiV2 ¶
type ApiV2 struct {
// contains filtered or unexported fields
}
func (*ApiV2) SyncCheck ¶
func (api *ApiV2) SyncCheck(common *Common, ce *XmlConfig, cookies []*http.Cookie, server string, skl *SyncKeyList) (retcode int, selector int, err error)
SyncCheck: synccheck api
func (*ApiV2) WebNewLoginPage ¶
func (api *ApiV2) WebNewLoginPage(common *Common, xc *XmlConfig, uri string) ([]*http.Cookie, error)
WebNewLoginPage: webwxnewloginpage api
func (*ApiV2) WebWxBatchGetContact ¶
func (api *ApiV2) WebWxBatchGetContact(common *Common, ce *XmlConfig, cookies []*http.Cookie, cl []*User) ([]byte, error)
WebWxBatchGetContact: webwxbatchgetcontact api
func (*ApiV2) WebWxCreateChatroom ¶
func (api *ApiV2) WebWxCreateChatroom(common *Common, ce *XmlConfig, cookies []*http.Cookie, users []*User, topic string) (interface{}, error)
WebWxCreateChatroom: webwxcreatechatroom api
func (*ApiV2) WebWxGetContact ¶
func (api *ApiV2) WebWxGetContact(common *Common, ce *XmlConfig, cookies []*http.Cookie) ([]byte, error)
WebWxGetContact: webwxgetcontact api
func (*ApiV2) WebWxGetIcon ¶
func (api *ApiV2) WebWxGetIcon(common *Common, ce *XmlConfig, cookies []*http.Cookie, username, chatroomid string) ([]byte, error)
WebWxGetIcon: webwxgeticon api
func (*ApiV2) WebWxGetIconByHeadImgUrl ¶
func (api *ApiV2) WebWxGetIconByHeadImgUrl(common *Common, ce *XmlConfig, cookies []*http.Cookie, headImgUrl string) ([]byte, error)
WebWxGetIconByHeadImgUrl: get head img
func (*ApiV2) WebWxGetMsgImg ¶
func (api *ApiV2) WebWxGetMsgImg(common *Common, ce *XmlConfig, cookies []*http.Cookie, msgId string) ([]byte, error)
WebWxGetMsgImg: webwxgetmsgimg api
func (*ApiV2) WebWxLogout ¶
WebWxlogout: webwxlogout api
func (*ApiV2) WebWxRevokeMsg ¶
func (api *ApiV2) WebWxRevokeMsg(common *Common, ce *XmlConfig, cookies []*http.Cookie, clientMsgId, svrMsgId, toUserName string) error
WebWxRevokeMsg: webwxrevokemsg api
func (*ApiV2) WebWxSendEmoticon ¶
func (api *ApiV2) WebWxSendEmoticon(common *Common, ce *XmlConfig, cookies []*http.Cookie, from, to, media string) (int, error)
WebWxSendEmoticon: webwxsendemoticon api
func (*ApiV2) WebWxSendMsg ¶
func (api *ApiV2) WebWxSendMsg(common *Common, ce *XmlConfig, cookies []*http.Cookie, from, to string, msg string) ([]byte, error)
WebWxSendMsg: webwxsendmsg api
func (*ApiV2) WebWxSendMsgImg ¶
func (api *ApiV2) WebWxSendMsgImg(common *Common, ce *XmlConfig, cookies []*http.Cookie, from, to, media string) (int, error)
WebWxSendMsgImg: webwxsendmsgimg api
func (*ApiV2) WebWxStatusNotify ¶
WebWxStatusNotify: webwxstatusnotify api
func (*ApiV2) WebWxSync ¶
func (api *ApiV2) WebWxSync(common *Common, ce *XmlConfig, cookies []*http.Cookie, msg chan []byte, skl *SyncKeyList) ([]*http.Cookie, error)
WebWxSync: webwxsync api
func (*ApiV2) WebWxSyncFlushCookie ¶
func (*ApiV2) WebWxUploadMedia ¶
func (api *ApiV2) WebWxUploadMedia(common *Common, ce *XmlConfig, cookies []*http.Cookie, filename string, content []byte) (string, error)
WebWxUploadMedia: webwxuploadmedia api
type BaseRequest ¶
BaseRequest: http request body BaseRequest
type BaseResponse ¶
BaseResponse: web api http response body BaseResponse struct
type ChatroomReqBody ¶
type ChatroomReqBody struct {
BaseRequest *BaseRequest
ChatRoomName string
InviteMemberList string
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GetWithHeader ¶
func (*Client) PostJsonByte ¶
func (*Client) PostJsonByteForResp ¶
type Common ¶
type Common struct {
AppId string
LoginUrl string
Lang string
DeviceID string
UserAgent string
CgiUrl string
CgiDomain string
SyncSrv string
UploadUrl string
MediaCount uint32
RedirectUri string
}
Common: session config
type ContactManager ¶
type ContactManager struct {
// contains filtered or unexported fields
}
ContactManager: contact manager
func CreateContactManagerFromBytes ¶
func CreateContactManagerFromBytes(cb []byte) (*ContactManager, error)
create CreateContactManagerFromBytes: create contact maanger from bytes
func (*ContactManager) AddUser ¶
func (s *ContactManager) AddUser(user *User)
AddContactFromUser: add a new user to contact manager
func (*ContactManager) AddUserFromBytes ¶
func (s *ContactManager) AddUserFromBytes(cb []byte) error
update AddContactFromBytes: upate contact manager from wxwebgetcontact response
func (*ContactManager) GetContactByPYQuanPin ¶
func (s *ContactManager) GetContactByPYQuanPin(sig string) *User
GetContactByPYQuanPin: get contact by User.PYQuanPin | User.RemarkPYQuanPin
func (*ContactManager) GetContactByUserName ¶
func (s *ContactManager) GetContactByUserName(un string) *User
get GetContactByUserName: get contact by UserName
func (*ContactManager) GetContactsByName ¶
func (s *ContactManager) GetContactsByName(sig string) []*User
GetContactByName: get contacts by User.NickName | User.RemarkName | User.DisplayName
func (*ContactManager) GetGroupContacts ¶
func (s *ContactManager) GetGroupContacts() []*User
GetGroupContacts: get all group contacts
func (*ContactManager) GetStrangers ¶
func (s *ContactManager) GetStrangers() []*User
GetStrangers: not group contact and not StarFriend and not special contact
type EmotionMessage ¶
type EmotionMessage struct {
ClientMsgId int
EmojiFlag int
FromUserName string
LocalID int
MediaId string
ToUserName string
Type int
}
EmotionMessage: gif/emoji message struct
type HandlerRegister ¶
type HandlerRegister struct {
// contains filtered or unexported fields
}
HandlerRegister: message handler manager
func CreateHandlerRegister ¶
func CreateHandlerRegister() *HandlerRegister
CreateHandlerRegister: create handler register
func (*HandlerRegister) Add ¶
func (hr *HandlerRegister) Add(key int, h Handler, name string) error
Add: add message handler to handler register
func (*HandlerRegister) DisableByName ¶
func (hr *HandlerRegister) DisableByName(name string) error
DisableByName: disable message handler by name
func (*HandlerRegister) DisableByType ¶
func (hr *HandlerRegister) DisableByType(key int) error
DisableByType: disable handler by message type
func (*HandlerRegister) Dump ¶
func (hr *HandlerRegister) Dump() string
Dump: output all message handlers
func (*HandlerRegister) EnableByName ¶
func (hr *HandlerRegister) EnableByName(name string) error
EnableByName: enable message handler by name
func (*HandlerRegister) EnableByType ¶
func (hr *HandlerRegister) EnableByType(key int) error
EnableByType: enable handler by message type
func (*HandlerRegister) Get ¶
func (hr *HandlerRegister) Get(key int) (error, []*HandlerWrapper)
Get: get message handler
func (*HandlerRegister) GetAll ¶
func (hr *HandlerRegister) GetAll() []*HandlerWrapper
GetAll: get all message handlers
type HandlerWrapper ¶
type HandlerWrapper struct {
// contains filtered or unexported fields
}
HandlerWrapper: message handler wrapper
func (*HandlerWrapper) GetEnabled ¶
func (s *HandlerWrapper) GetEnabled() bool
GetEnabled: export enabled for external projects
func (*HandlerWrapper) GetName ¶
func (s *HandlerWrapper) GetName() string
GetName: export name for external projects
func (*HandlerWrapper) Run ¶
func (s *HandlerWrapper) Run(session *Session, msg *ReceivedMessage)
Run: run message handler
type InitReqBody ¶
type InitReqBody struct {
BaseRequest *BaseRequest
Msg interface{}
SyncKey *SyncKeyList
Code int
FromUserName string
ToUserName string
ClientMsgId int
ClientMediaId int
TotalLen int
StartPos int
DataLen int
MediaType int
Scene int
Count int
List []*User
Opcode int
SceneList []int
SceneListCount int
VerifyContent string
VerifyUserList []*VerifyUser
VerifyUserListSize int
MemberCount int
MemberList []*User
Topic string
// contains filtered or unexported fields
}
InitReqBody: common http request body struct
type LogoutReqBody ¶
type LogoutReqBody struct {
// contains filtered or unexported fields
}
LogoutReqBody: logout api http request body
type MediaMessage ¶
type MediaMessage struct {
Type int
Content string
FromUserName string
ToUserName string
LocalID int
ClientMsgId int
MediaId string
}
MediaMessage
type MemberManager ¶
type MemberManager struct {
Group *User
}
MemberManager: group contact member manager
func CreateMemberManagerFromBytes ¶
func CreateMemberManagerFromBytes(session *Session, b []byte) (*MemberManager, error)
CreateMemberManagerFromBytes: create memeber manager by WxWebBatchGetContactResponse
func CreateMemberManagerFromGroupContact ¶
func CreateMemberManagerFromGroupContact(session *Session, user *User) (*MemberManager, error)
CreateMemberManagerFromGroupContact: create member manager by group contact info
func (*MemberManager) GetContactByUserName ¶
func (s *MemberManager) GetContactByUserName(username string) *User
GetContactByUserName: get a certain member by username
func (*MemberManager) GetContactsByGender ¶
func (s *MemberManager) GetContactsByGender(sex int) []*User
GetContactsByGender: get contacts by gender
func (*MemberManager) GetHeadImgUrlsByGender ¶
func (s *MemberManager) GetHeadImgUrlsByGender(sex int) []string
GetHeadImgUrlByGender: get head img url detail by gender
func (*MemberManager) Update ¶
func (s *MemberManager) Update(session *Session) error
Update: get User details of group members
type PSession ¶
type PSession struct {
WxName string
WxWebCommon Common `json:"common"`
WxWebXcg XmlConfig `json:"config"`
Cookies []http.Cookie `json:"cookies,omitempty"`
Bot User `json:"bot,omitempty"`
QrcodePath string `json:"qrcode,omitempty"`
QrcodeUUID string `json:"uuid,omitempty"`
CreateTime int64 `json:"time,omitempty"`
}
type ReceivedMessage ¶
type ReceivedMessage struct {
IsGroup bool
MsgId string
Content string
FromUserName string
ToUserName string
Who string
MsgType int
SubType int
OriginContent string
At string
Url string
RecommendInfo *RecommendInfo
}
ReceivedMessage: for received message
type RecommendInfo ¶
type RevokeReqBody ¶
type RevokeReqBody struct {
BaseRequest *BaseRequest
ClientMsgId string
SvrMsgId string
ToUserName string
}
RevokeReqBody: revoke message api http request body
type Session ¶
type Session struct {
WxWebCommon *Common
WxWebXcg *XmlConfig
Cookies []*http.Cookie
SynKeyList *SyncKeyList
Bot *User
Cm *ContactManager
QrcodePath string //qrcode path
QrcodeUUID string //uuid
HandlerRegister *HandlerRegister
CreateTime int64
LastMsgID string
Api *ApiV2
OnLoginAvatar func(string) error
AfterLogin func() error
SendChan chan *TextMessage
// contains filtered or unexported fields
}
Session: wechat bot session
func CreateSession ¶
func CreateSession(common *Common, handlerRegister *HandlerRegister, qrmode int) (*Session, error)
CreateSession: create wechat bot session if common is nil, session will be created with default config if handlerRegister is nil, session will create a new HandlerRegister
func CreateWebSessionWithPath ¶
func CreateWebSessionWithPath(common *Common, handlerRegister *HandlerRegister, qrcode_path string) (*Session, error)
func (*Session) AcceptFriend ¶
func (s *Session) AcceptFriend(verifyContent string, vul []*VerifyUser) error
func (*Session) GetCookies ¶
func (*Session) LoginAndServe ¶
LoginAndServe: login wechat web and enter message receiving loop
func (*Session) SendEmotionFromBytes ¶
SendEmotionFromBytes: send gif/emoji from mem
func (*Session) SendEmotionFromPath ¶
SendEmotionFromPath: send gif, upload then send
func (*Session) SendImgFromBytes ¶
SendImgFromBytes: send image from mem
func (*Session) SetAfterLogin ¶
func (*Session) SetCookies ¶
func (*Session) SetOnLoginAvatar ¶
type SyncKeyList ¶
SyncKeyList: list of synckey
func GetSyncKeyListFromJc ¶
func GetSyncKeyListFromJc(jc *rrconfig.JsonConfig) (*SyncKeyList, error)
func (*SyncKeyList) String ¶
func (s *SyncKeyList) String() string
s.String output synckey list in string
type TextMessage ¶
type TextMessage struct {
Type int
Content string
FromUserName string
ToUserName string
LocalID int
ClientMsgId int
}
TextMessage: text message struct
type User ¶
type User struct {
Uin int
UserName string
NickName string
HeadImgUrl string
ContactFlag int
MemberCount int
MemberList []*User
RemarkName string
PYInitial string
PYQuanPin string
RemarkPYInitial string
RemarkPYQuanPin string
HideInputBarFlag int
StarFriend int
Sex int
Signature string
AppAccountFlag int
Statues int
AttrStatus uint32
Province string
City string
Alias string
VerifyFlag int
OwnerUin int
WebWxPluginSwitch int
HeadImgFlag int
SnsFlag int
UniFriend int
DisplayName string
ChatRoomId int
KeyWord string
EncryChatRoomId string
IsOwner int
MemberStatus int
}
User: contact struct
func GetUserInfoFromJc ¶
type VerifyUser ¶
VerifyUser: verify user request body struct
type WxWebBatchGetContactResponse ¶
type WxWebBatchGetContactResponse struct {
BaseResponse *BaseResponse
Count int
ContactList []*User
}
WxWebBatchGetContactResponse: batch get contact response struct
type WxWebGetContactResponse ¶
type WxWebGetContactResponse struct {
BaseResponse *BaseResponse
MemberCount int
MemberList []*User
Seq int
}
WxWebGetContactResponse: get contact response struct
type XmlConfig ¶
type XmlConfig struct {
XMLName xml.Name `xml:"error"`
Ret int `xml:"ret"`
Message string `xml:"message"`
Skey string `xml:"skey"`
Wxsid string `xml:"wxsid"`
Wxuin string `xml:"wxuin"`
PassTicket string `xml:"pass_ticket"`
IsGrayscale int `xml:"isgrayscale"`
}
XmlConfig: web api xml response struct