wxweb

package
v0.0.0-...-6bc755a Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2019 License: MIT Imports: 25 Imported by: 0

README

songtianyi/wechat-go

This directory is comes from songtianyi/wechat-go.

Thanks for songtianyi's work on API of WebWeChat.

And I have change some usage for send msg active for WeChatNotice.

Documentation

Index

Constants

View Source
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

)
View Source
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

View Source
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)
)
View Source
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 GetLoginAvatar(resp string) (string, error)

func GetRandomStringFromNum

func GetRandomStringFromNum(length int) string

func JsLogin

func JsLogin(common *Common) (string, error)

JsLogin: jslogin api

func Login

func Login(common *Common, uuid, tip string) (string, error)

Login: login api

func QrCode

func QrCode(common *Common, uuid string) ([]byte, error)

QrCode: get qrcode

func ReadSessionData

func ReadSessionData(path string) map[string]*Session

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

func WebNewLoginPage(common *Common, xc *XmlConfig, uri string) ([]*http.Cookie, error)

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

func WebWxGetContact(common *Common, ce *XmlConfig, cookies []*http.Cookie) ([]byte, error)

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 WebWxInit

func WebWxInit(common *Common, ce *XmlConfig) ([]byte, error)

WebWxInit: webwxinit api

func WebWxLogout

func WebWxLogout(common *Common, ce *XmlConfig, cookies []*http.Cookie) error

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

func WebWxStatusNotify(common *Common, ce *XmlConfig, bot *User) (int, error)

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 WebWxSyncFlushCookie(common *Common, ce *XmlConfig, cookies []*http.Cookie, skl *SyncKeyList) ([]*http.Cookie, error)

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

func WriteSessionData(multiSession map[string]*Session, path string)

Types

type ApiV2

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

func NewApiV2

func NewApiV2() *ApiV2

func (*ApiV2) JsLogin

func (api *ApiV2) JsLogin(common *Common) (string, error)

JsLogin: jslogin api

func (*ApiV2) Login

func (api *ApiV2) Login(common *Common, uuid, tip string) (string, error)

Login: login api

func (*ApiV2) QrCode

func (api *ApiV2) QrCode(common *Common, uuid string) ([]byte, error)

QrCode: get qrcode

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) WebWxInit

func (api *ApiV2) WebWxInit(common *Common, ce *XmlConfig) ([]byte, error)

WebWxInit: webwxinit api

func (*ApiV2) WebWxLogout

func (api *ApiV2) WebWxLogout(common *Common, ce *XmlConfig, cookies []*http.Cookie) error

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

func (api *ApiV2) WebWxStatusNotify(common *Common, ce *XmlConfig, bot *User) (int, error)

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 (api *ApiV2) WebWxSyncFlushCookie(common *Common, ce *XmlConfig, cookies []*http.Cookie, skl *SyncKeyList) ([]*http.Cookie, error)

func (*ApiV2) WebWxUploadMedia

func (api *ApiV2) WebWxUploadMedia(common *Common, ce *XmlConfig, cookies []*http.Cookie,
	filename string, content []byte) (string, error)

WebWxUploadMedia: webwxuploadmedia api

func (*ApiV2) WebWxVerifyUser

func (api *ApiV2) WebWxVerifyUser(common *Common, ce *XmlConfig, cookies []*http.Cookie, opcode int, verifyContent string, vul []*VerifyUser) ([]byte, error)

WebWxVerifyUser: webwxverifyuser api

func (*ApiV2) WxUpdateChatroom

func (a *ApiV2) WxUpdateChatroom(common *Common, ce *XmlConfig, cookies []*http.Cookie, ChatRoomName, InviteMemberList string)

WxUpdateChatroom

type BaseRequest

type BaseRequest struct {
	Uin      string
	Sid      string
	Skey     string
	DeviceID string
}

BaseRequest: http request body BaseRequest

type BaseResponse

type BaseResponse struct {
	Ret    int
	ErrMsg string
}

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 NewClient

func NewClient() *Client

func (*Client) Get

func (c *Client) Get(url string, data *url.Values) ([]byte, error)

func (*Client) GetByte

func (c *Client) GetByte(url string, data []byte) ([]byte, error)

func (*Client) GetWithHeader

func (c *Client) GetWithHeader(url string, heder Header) ([]byte, error)

func (*Client) Post

func (c *Client) Post(url string, data *url.Values) ([]byte, error)

func (*Client) PostJson

func (c *Client) PostJson(url string, m map[string]interface{}) ([]byte, error)

func (*Client) PostJsonByte

func (c *Client) PostJsonByte(url string, json []byte) ([]byte, error)

func (*Client) PostJsonByteForResp

func (c *Client) PostJsonByteForResp(url string, json []byte) (*http.Response, []byte, error)

func (*Client) SetJar

func (c *Client) SetJar(jar http.CookieJar)

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) GetAll

func (s *ContactManager) GetAll() []*User

GetAll: get all contacts

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 Handler

type Handler func(*Session, *ReceivedMessage)

Handler: message function wrapper

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 Header map[string]string

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 RecommendInfo struct {
	Ticket     string
	UserName   string
	NickName   string
	Content    string
	Alias      string
	AttrStatus uint32
	City       string
	OpCode     int
	Province   string
	QQNum      int
	Scene      int
	Sex        int
	Signature  string
	VerifyFlag int
}

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) After

func (s *Session) After(duration time.Duration) *Session

message funcs

func (*Session) At

func (s *Session) At(d time.Time) *Session

func (*Session) GetCookies

func (s *Session) GetCookies() []*http.Cookie

func (*Session) GetImg

func (s *Session) GetImg(msgId string) ([]byte, error)

GetImg: get img by MsgId

func (*Session) LoginAndServe

func (s *Session) LoginAndServe(useCache bool) error

LoginAndServe: login wechat web and enter message receiving loop

func (*Session) Logout

func (s *Session) Logout() error

user funcs Logout: logout web wechat

func (*Session) RevokeMsg

func (s *Session) RevokeMsg(clientMsgId, svrMsgId, toUserName string)

RevokeMsg: revoke message

func (*Session) SendEmotionFromBytes

func (s *Session) SendEmotionFromBytes(b []byte, from, to string)

SendEmotionFromBytes: send gif/emoji from mem

func (*Session) SendEmotionFromPath

func (s *Session) SendEmotionFromPath(path, from, to string)

SendEmotionFromPath: send gif, upload then send

func (*Session) SendImg

func (s *Session) SendImg(path, from, to string)

SendImg: send img, upload then send

func (*Session) SendImgFromBytes

func (s *Session) SendImgFromBytes(b []byte, path, from, to string)

SendImgFromBytes: send image from mem

func (*Session) SendText

func (s *Session) SendText(msg, from, to string) (string, string, error)

SendText: send text msg type 1

func (*Session) SetAfterLogin

func (s *Session) SetAfterLogin(f func() error)

func (*Session) SetCookies

func (s *Session) SetCookies(cookies []*http.Cookie)

func (*Session) SetOnLoginAvatar

func (s *Session) SetOnLoginAvatar(f func(avatar string) error)

type SyncKey

type SyncKey struct {
	Key int
	Val int
}

SyncKey: struct for synccheck

type SyncKeyList

type SyncKeyList struct {
	Count int
	List  []SyncKey
}

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 UrlGroup

type UrlGroup struct {
	IndexUrl  string
	UploadUrl string
	SyncUrl   string
}

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

func GetUserInfoFromJc(jc *rrconfig.JsonConfig) (*User, error)

type VerifyUser

type VerifyUser struct {
	Value            string
	VerifyUserTicket string
}

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

Jump to

Keyboard shortcuts

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