Documentation ¶
Index ¶
- Constants
- Variables
- type AppInfo
- type BaseRequest
- type BaseResponse
- type BatchContactParam
- type BatchContactResp
- type Caller
- type Config
- type GetUUIDParams
- type HyperLink
- type InitResp
- type KeyVal
- type Member
- type MemberResp
- type Message
- type MessageImage
- type MessageRecord
- type MsgResp
- type NotifyParams
- type NotifyResp
- type Request
- type Response
- type SyncCheckResp
- type SyncKey
- type SyncParams
- type SyncResp
- type User
- type UserNameSubParam
- type Wechat
- func (w *Wechat) AddMember(name string) (err error)
- func (w *Wechat) AutoReplyMsg() string
- func (w *Wechat) CreateRoom(name string) (err error)
- func (w *Wechat) FetchImg(apiURI string, body io.Reader) (img image.Image, err error)
- func (w *Wechat) GetContacts() (err error)
- func (w *Wechat) GetContactsInBatch(memberNames []string) (member []Member, err error)
- func (w *Wechat) GetGroupName(id string) (name string)
- func (w *Wechat) GetQR() (err error)
- func (w *Wechat) GetTuringReply(msg string) (retMsg string, err error)
- func (w *Wechat) GetUUID() (err error)
- func (w *Wechat) GetUnixTime() string
- func (w *Wechat) GetUnixTimeInt() int
- func (w *Wechat) Login() (err error)
- func (w *Wechat) MsgDaemon(msgOut chan MessageRecord, autoReply chan int)
- func (w *Wechat) Post(url string, data url.Values, jsonFmt bool) (result string)
- func (w *Wechat) PullMsg()
- func (w *Wechat) Send(apiURI string, body io.Reader, call Caller) (err error)
- func (w *Wechat) SendImage(name, fileName string) (err error)
- func (w *Wechat) SendMsg(toUserName, message string, isFile bool) (err error)
- func (w *Wechat) SendMsgToAll(word string) (err error)
- func (w *Wechat) SendTest(apiURI string, body io.Reader, call Caller) (err error)
- func (w *Wechat) SetCookies()
- func (w *Wechat) SetSynKey()
- func (w *Wechat) StatusNotify() (err error)
- func (w *Wechat) SyncCheck() (resp SyncCheckResp, err error)
- func (w *Wechat) SyncDaemon(msgIn chan Message)
- func (w *Wechat) TestCheck() (err error)
- func (w *Wechat) WaitForLogin() (err error)
Constants ¶
View Source
const (
StatusSuccess = 0
)
View Source
const (
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"
)
Variables ¶
View Source
var ( SaveSubFolders = map[string]string{"webwxgeticon": "icons", "webwxgetheadimg": "headimgs", "webwxgetmsgimg": "msgimgs", "webwxgetvideo": "videos", "webwxgetvoice": "voices", "_showQRCodeImg": "qrcodes", } AppID = "wx782c26e4c19acffb" Lang = "zh_CN" LastCheckTs = time.Now() LoginUrl = "https://login.weixin.qq.com/jslogin" QrUrl = "https://login.weixin.qq.com/qrcode/" TuringUrl = "" //"http://www.tuling123.com/openapi/api" APIKEY = "" //"391ad66ebad2477b908dce8e79f101e7" TUringUserId = "" //"abc123" )
View Source
var ( SpecialUsers = []string{ "newsapp", "fmessage", "filehelper", "weibo", "qqmail", "tmessage", "qmessage", "qqsync", "floatbottle", "lbsapp", "shakeapp", "medianote", "qqfriend", "readerapp", "blogapp", "facebookapp", "masssendapp", "meishiapp", "feedsapp", "voip", "blogappweixin", "weixin", "brandsessionholder", "weixinreminder", "wxid_novlwrv3lqwv11", "gh_22b87fa7cb3c", "officialaccounts", "notification_messages", "wxitil", "userexperience_alarm", } SyncHosts = []string{ "wx2.qq.com", "webpush.wx2.qq.com", "wx8.qq.com", "webpush.wx8.qq.com", "qq.com", "webpush.wx.qq.com", "web2.wechat.com", "webpush.web2.wechat.com", "wechat.com", "webpush.web.wechat.com", "webpush.weixin.qq.com", "webpush.wechat.com", "webpush1.wechat.com", "webpush2.wechat.com", "webpush.wx.qq.com", "webpush2.wx.qq.com", } )
Functions ¶
This section is empty.
Types ¶
type BaseRequest ¶
type BaseRequest struct { XMLName xml.Name `xml:"error" json:"-"` Ret int `xml:"ret" json:"-"` Message string `xml:"message" json:"-"` Skey string `xml:"skey" json:"Skey"` Wxsid string `xml:"wxsid" json:"Sid"` Wxuin int64 `xml:"wxuin" json:"Uin"` PassTicket string `xml:"pass_ticket" json:"-"` DeviceID string `xml:"-" json:"DeviceID"` }
type BaseResponse ¶
type BatchContactParam ¶
type BatchContactParam struct { BaseRequest BaseRequest `json:"BaseRequest"` List []UserNameSubParam `json:"List"` Count int `json:"Count"` }
type BatchContactResp ¶
type GetUUIDParams ¶
type GetUUIDParams struct { AppID string `json:"appid"` Fun string `json:"fun"` Lang string `json:"lang"` UnixTime float64 `json:"-"` }
func NewGetUUIDParams ¶
func NewGetUUIDParams(appid, fun, lang string, times float64) *GetUUIDParams
type InitResp ¶
type InitResp struct { Response User User `json:"User"` Count int `json:"Count"` ContactList []User `json:"ContactList"` SyncKey SyncKey `json:"SyncKey"` ChatSet string `json:"ChatSet"` SKey string `json:"SKey"` ClientVersion int `json:"ClientVersion"` SystemTime int `json:"SystemTime"` GrayScale int `json:"GrayScale"` InviteStartCount int `json:"InviteStartCount"` MPSubscribeMsgCount int `json:"MPSubscribeMsgCount"` //MPSubscribeMsgList string `json:"MPSubscribeMsgList"` ClickReportInterval int `json:"ClickReportInterval"` }
type Member ¶
type Member struct { Uin int64 UserName string NickName string HeadImgUrl string ContactFlag int MemberCount int MemberList []User RemarkName string HideInputBarFlag int Sex int Signature string VerifyFlag int OwnerUin int PYInitial string PYQuanPin string RemarkPYInitial string RemarkPYQuanPin string StarFriend int AppAccountFlag int Statues int AttrStatus int Province string City string Alias string SnsFlag int UniFriend int DisplayName string ChatRoomId int KeyWord string EncryChatRoomId string }
type MemberResp ¶
type Message ¶
type Message struct { FromUserName string PlayLength int RecommendInfo []string Content string StatusNotifyUserName string StatusNotifyCode int Status int VoiceLength int ToUserName string ForwardFlag int AppMsgType int AppInfo AppInfo Url string ImgStatus int MsgType int ImgHeight int MediaId string FileName string FileSize string FromUserNickName string ToUserNickName string MsgId string Img *image.Image }
type MessageImage ¶
type MessageRecord ¶
type MessageRecord struct { From string To string Text string Speaker string MsgId string ContentImg *image.Image Type int Url string }
func NewImageMessageRecordIn ¶
func NewImageMessageRecordIn(message MessageImage) *MessageRecord
func NewMessageRecordIn ¶
func NewMessageRecordIn(message Message) *MessageRecord
func NewMessageRecordOut ¶
func NewMessageRecordOut(from string, message MessageRecord) *MessageRecord
type NotifyParams ¶
type NotifyParams struct { BaseRequest *BaseRequest Code int FromUserName string ToUserName string ClientMsgId int }
type NotifyResp ¶
type Response ¶
type Response struct {
BaseResponse *BaseResponse `json:"BaseResponse"`
}
type SyncCheckResp ¶
type SyncParams ¶
type SyncParams struct { BaseRequest BaseRequest `json:"BaseRequest"` SyncKey SyncKey `json:"SyncKey"` RR int64 `json:"rr"` }
type User ¶
type User struct { UserName string `json:"UserName"` Uin int64 `json:"Uin"` NickName string `json:"NickName"` HeadImgUrl string `json:"HeadImgUrl" xml:""` RemarkName string `json:"RemarkName" xml:""` PYInitial string `json:"PYInitial" xml:""` PYQuanPin string `json:"PYQuanPin" xml:""` RemarkPYInitial string `json:"RemarkPYInitial" xml:""` RemarkPYQuanPin string `json:"RemarkPYQuanPin" xml:""` HideInputBarFlag int `json:"HideInputBarFlag" xml:""` StarFriend int `json:"StarFriend" xml:""` Sex int `json:"Sex" xml:""` Signature string `json:"Signature" xml:""` AppAccountFlag int `json:"AppAccountFlag" xml:""` VerifyFlag int `json:"VerifyFlag" xml:""` ContactFlag int `json:"ContactFlag" xml:""` WebWxPluginSwitch int `json:"WebWxPluginSwitch" xml:""` HeadImgFlag int `json:"HeadImgFlag" xml:""` SnsFlag int `json:"SnsFlag" xml:""` }
type UserNameSubParam ¶
type Wechat ¶
type Wechat struct { User User Root string Debug bool MessageNotify bool Uuid string BaseUri string RedirectedUri string Uin string Sid string Skey string PassTicket string DeviceId string BaseRequest map[string]string LowSyncKey string SyncKeyStr string SyncHost string SyncKey SyncKey Users []string InitContactList []User //谈话的人 MemberList []Member // ContactList []Member //好友 GroupList []string //群 GroupMemberList []Member //群友 PublicUserList []Member //公众号 SpecialUserList []Member //特殊账号 AutoReplyMode bool //default false AutoOpen bool Interactive bool TotalMember int TimeOut int // 同步时间间隔 default:20 MediaCount int // -1 SaveFolder string QrImagePath string Client *http.Client Request *BaseRequest Log *log.Logger MemberMap map[string]Member ChatSet []string AutoReply bool //是否自动回复 ReplyMsgs []string // 回复的消息列表 AutoReplySrc bool //默认false,自动回复,列表。true调用AI机器人。 SetCookie []string // contains filtered or unexported fields }
func (*Wechat) AutoReplyMsg ¶
func (*Wechat) CreateRoom ¶
func (*Wechat) GetContacts ¶
func (*Wechat) GetContactsInBatch ¶
func (*Wechat) GetGroupName ¶
func (*Wechat) GetTuringReply ¶
func (*Wechat) GetUnixTime ¶
func (*Wechat) GetUnixTimeInt ¶
func (*Wechat) MsgDaemon ¶
func (w *Wechat) MsgDaemon(msgOut chan MessageRecord, autoReply chan int)
func (*Wechat) SendMsgToAll ¶
func (*Wechat) SetCookies ¶
func (w *Wechat) SetCookies()
func (*Wechat) StatusNotify ¶
func (*Wechat) SyncCheck ¶
func (w *Wechat) SyncCheck() (resp SyncCheckResp, err error)
func (*Wechat) WaitForLogin ¶
Click to show internal directories.
Click to hide internal directories.