v0.0.0-...-38a9a3c Latest Latest

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

Go to latest
Published: Jul 16, 2019 License: GPL-3.0 Imports: 26 Imported by: 0




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"


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{


This section is empty.


type AppInfo

type AppInfo struct {
	Type  int
	AppID string

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 BaseResponse struct {
	Ret    int
	ErrMsg string

type BatchContactParam

type BatchContactParam struct {
	BaseRequest BaseRequest        `json:"BaseRequest"`
	List        []UserNameSubParam `json:"List"`
	Count       int                `json:"Count"`

type BatchContactResp

type BatchContactResp struct {
	Count       int
	ContactList []Member

type Caller

type Caller interface {
	IsSuccess() bool
	Error() error

type Config

type Config struct {
	AutoReply bool     `json:"auto_reply"`
	AutoSave  bool     `json:"auto_save"`
	ReplyMsgs []string `json:"reply_msgs"`

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 HyperLink struct {
	Title string `xml:"title" json:"Title"`
	Des   string `xml:"des" json:"Des"`
	Url   string `xml:"url" json:"Url"`

type InitResp

type InitResp struct {
	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 KeyVal

type KeyVal struct {
	Key int `json:"Key"`
	Val int `json:"Val"`

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

func (*Member) IsNormal

func (this *Member) IsNormal(mySelf string) bool

func (*Member) IsSpecail

func (this *Member) IsSpecail() bool

type MemberResp

type MemberResp struct {
	MemberCount  int
	ChatRoomName string
	MemberList   []Member
	Seq          int

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

func (Message) String

func (m Message) String() string

type MessageImage

type MessageImage struct {
	Img image.Image
	//MsgId    string
	TargetId string

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 MsgResp

type MsgResp struct {

type NotifyParams

type NotifyParams struct {
	BaseRequest  *BaseRequest
	Code         int
	FromUserName string
	ToUserName   string
	ClientMsgId  int

type NotifyResp

type NotifyResp struct {
	MsgID string

type Request

type Request struct {
	BaseRequest *BaseRequest

	MemberCount int    `json:",omitempty"`
	MemberList  []User `json:",omitempty"`
	Topic       string `json:",omitempty"`

	ChatRoomName  string `json:",omitempty"`
	DelMemberList string `json:",omitempty"`
	AddMemberList string `json:",omitempty"`

type Response

type Response struct {
	BaseResponse *BaseResponse `json:"BaseResponse"`

func (*Response) Error

func (r *Response) Error() error

func (*Response) IsSuccess

func (r *Response) IsSuccess() bool

type SyncCheckResp

type SyncCheckResp struct {
	RetCode  int `json:"retcode"`
	Selector int `json:"selector"`

type SyncKey

type SyncKey struct {
	Count int      `json:"Count"`
	List  []KeyVal `json:"List"`

type SyncParams

type SyncParams struct {
	BaseRequest BaseRequest `json:"BaseRequest"`
	SyncKey     SyncKey     `json:"SyncKey"`
	RR          int64       `json:"rr"`

type SyncResp

type SyncResp struct {
	SyncKey      SyncKey       `json:"SyncKey"`
	ContinueFlag int           `json:"ContinueFlag"`
	AddMsgList   []interface{} `json:"AddMsgList"`

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 UserNameSubParam struct {
	UserName        string `json:"UserName"`
	EncryChatRoomId string `json:"EncryChatRoomId"`

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 NewWechat

func NewWechat(logger *log.Logger) *Wechat

func (*Wechat) AddMember

func (w *Wechat) AddMember(name string) (err error)

func (*Wechat) AutoReplyMsg

func (w *Wechat) AutoReplyMsg() string

func (*Wechat) CreateRoom

func (w *Wechat) CreateRoom(name string) (err error)

func (*Wechat) FetchImg

func (w *Wechat) FetchImg(apiURI string, body io.Reader) (img image.Image,
	err error)

func (*Wechat) GetContacts

func (w *Wechat) GetContacts() (err error)

func (*Wechat) GetContactsInBatch

func (w *Wechat) GetContactsInBatch(memberNames []string) (member []Member, err error)

func (*Wechat) GetGroupName

func (w *Wechat) GetGroupName(id string) (name string)

func (*Wechat) GetQR

func (w *Wechat) GetQR() (err error)

func (*Wechat) GetTuringReply

func (w *Wechat) GetTuringReply(msg string) (retMsg string, err error)

func (*Wechat) GetUUID

func (w *Wechat) GetUUID() (err error)

func (*Wechat) GetUnixTime

func (w *Wechat) GetUnixTime() string

func (*Wechat) GetUnixTimeInt

func (w *Wechat) GetUnixTimeInt() int

func (*Wechat) Login

func (w *Wechat) Login() (err error)

func (*Wechat) MsgDaemon

func (w *Wechat) MsgDaemon(msgOut chan MessageRecord, autoReply chan int)

func (*Wechat) Post

func (w *Wechat) Post(url string, data url.Values, jsonFmt bool) (result string)

func (*Wechat) PullMsg

func (w *Wechat) PullMsg()

func (*Wechat) Send

func (w *Wechat) Send(apiURI string, body io.Reader, call Caller) (err error)

func (*Wechat) SendImage

func (w *Wechat) SendImage(name, fileName string) (err error)

func (*Wechat) SendMsg

func (w *Wechat) SendMsg(toUserName, message string, isFile bool) (err error)

func (*Wechat) SendMsgToAll

func (w *Wechat) SendMsgToAll(word string) (err error)

func (*Wechat) SendTest

func (w *Wechat) SendTest(apiURI string, body io.Reader, call Caller) (err error)

func (*Wechat) SetCookies

func (w *Wechat) SetCookies()

func (*Wechat) SetSynKey

func (w *Wechat) SetSynKey()

func (*Wechat) StatusNotify

func (w *Wechat) StatusNotify() (err error)

func (*Wechat) SyncCheck

func (w *Wechat) SyncCheck() (resp SyncCheckResp, err error)

func (*Wechat) SyncDaemon

func (w *Wechat) SyncDaemon(msgIn chan Message)


func (*Wechat) TestCheck

func (w *Wechat) TestCheck() (err error)

func (*Wechat) WaitForLogin

func (w *Wechat) WaitForLogin() (err error)

Jump to

Keyboard shortcuts

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