Documentation
¶
Index ¶
- Constants
- type BaseRequest
- type BaseResponse
- type Caller
- type Configure
- type Contact
- type CountedContent
- type Event
- type EventContactData
- type EventMsgData
- type EventTimerData
- type EventTimingtData
- type Msg
- type Response
- type UUIDProcessor
- type WeChat
- func (wechat *WeChat) AddTimer(du time.Duration)
- func (wechat *WeChat) AddTiming(hm string)
- func (wechat *WeChat) AllContacts() []*Contact
- func (wechat *WeChat) ContactByGGID(id string) (*Contact, error)
- func (wechat *WeChat) ContactByUserName(un string) (*Contact, error)
- func (wechat *WeChat) ContactsByNickName(nn string) ([]*Contact, error)
- func (wechat *WeChat) CookieDataTicket() string
- func (wechat *WeChat) DownloadMedia(url string, localPath string) (string, error)
- func (wechat *WeChat) Excute(path string, body io.Reader, call Caller) error
- func (wechat *WeChat) ExcuteRequest(req *http.Request, call Caller) error
- func (wechat *WeChat) ForceUpdateGroup(groupUserName string)
- func (wechat *WeChat) GetContactHeadImg(c *Contact) ([]byte, error)
- func (wechat *WeChat) Go()
- func (wechat *WeChat) Handle(path string, handler func(Event))
- func (wechat *WeChat) Hook(f func(Event))
- func (wechat *WeChat) MembersOfGroup(groupUserName string) ([]*Contact, error)
- func (wechat *WeChat) PassTicketKV() string
- func (wechat *WeChat) ResetHandlers()
- func (wechat *WeChat) SendFile(path, to string) error
- func (wechat *WeChat) SendMsg(message Msg) error
- func (wechat *WeChat) SendTextMsg(msg, to string) error
- func (wechat *WeChat) SkeyKV() string
- func (wechat *WeChat) Stop()
- func (wechat *WeChat) SyncContact() error
- func (wechat *WeChat) UpateGroupIfNeeded(groupID string)
- func (wechat *WeChat) UploadMedia(buf []byte, kind types.Type, info os.FileInfo, to string) (string, error)
- func (wechat *WeChat) UserNameByNickName(nn string) ([]string, error)
Constants ¶
const ( // Offical 公众号 ... Offical = 0 // Friend 好友 ... Friend = 1 // Group 群组 ... Group = 2 // Member 群组成员 ... Member = 3 // FriendAndMember 即是好友也是群成员 ... FriendAndMember = 4 )
const ( // Delete 删除联系人 Delete = 0 // Modify 有人修改了自己的信息 Modify = 1 )
Variables ¶
This section is empty.
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:"-"`
Wxsid string `xml:"wxsid" json:"Sid"`
Skey string `xml:"skey"`
DeviceID string `xml:"-"`
Wxuin int64 `xml:"wxuin" json:"Uin"`
PassTicket string `xml:"pass_ticket" json:"-"`
}
BaseRequest is a base for all wx api request.
type BaseResponse ¶
BaseResponse for all api resp.
type Configure ¶
type Configure struct {
Processor UUIDProcessor
Debug bool
Storage string
FuzzyDiff bool
UniqueGroupMember bool
// contains filtered or unexported fields
}
Configure ...
func DefaultConfigure ¶
func DefaultConfigure() *Configure
DefaultConfigure create default configuration
type Contact ¶
type Contact struct {
GGID string
UserName string
NickName string
HeadImgURL string `json:"HeadImgUrl"`
HeadHash string
RemarkName string
DisplayName string
StarFriend float64
Sex float64
Signature string
VerifyFlag float64
ContactFlag float64
HeadImgFlag float64
Province string
City string
Alias string
EncryChatRoomID string `json:"EncryChatRoomId"`
Type int
MemberList []*Contact
}
Contact is wx Account struct
type CountedContent ¶
CountedContent is a Wrappered for data struct from wx server
type EventContactData ¶
EventContactData 通讯录中删人 或者有人修改资料的时候
type EventMsgData ¶
type EventMsgData struct {
MsgID string `json:"msg_id"`
IsGroupMsg bool `json:"is_group_msg"`
IsMediaMsg bool `json:"is_media_msg"`
IsSendedByMySelf bool `json:"is_sended_by_my_self"`
MsgType int64 `json:"msg_type"`
AtMe bool `json:"at_me"`
MediaURL string `json:"media_url"`
Content string `json:"content"`
FromUserName string `json:"from_user_name"`
FromGGID string `json:"from_ggid"`
SenderUserName string `json:"sender_user_name"`
SenderGGID string `json:"sender_ggid"`
ToUserName string `json:"to_user_name"`
ToGGID string `json:"to_ggid"`
OriginalMsg map[string]interface{} `json:"original_msg"`
}
EventMsgData 新消息
type EventTimerData ¶
EventTimerData ...
type UUIDProcessor ¶
UUIDProcessor scan this uuid
type WeChat ¶
type WeChat struct {
Client *http.Client
BaseURL string
BaseRequest *BaseRequest
MySelf Contact
IsLogin bool
// contains filtered or unexported fields
}
WeChat container a default http client and base request.
func AwakenNewBot ¶
AwakenNewBot is start point for wx bot.
func (*WeChat) ContactByGGID ¶
ContactByGGID ...
func (*WeChat) ContactByUserName ¶
ContactByUserName ...
func (*WeChat) ContactsByNickName ¶
ContactsByNickName search contact with nick name
func (*WeChat) CookieDataTicket ¶
CookieDataTicket ...
func (*WeChat) DownloadMedia ¶
DownloadMedia use to download a voice or immage msg
func (*WeChat) ExcuteRequest ¶
ExcuteRequest is desined for perform http request
func (*WeChat) ForceUpdateGroup ¶
ForceUpdateGroup upate group infomation
func (*WeChat) GetContactHeadImg ¶
GetContactHeadImg ...
func (*WeChat) MembersOfGroup ¶
MembersOfGroup ..返回群中所有的成员
func (*WeChat) PassTicketKV ¶
PassTicketKV return a string like `pass_ticket=sdfewsvdwd=`
func (*WeChat) ResetHandlers ¶
func (wechat *WeChat) ResetHandlers()
ResetHandlers remove all regeisted handler
func (*WeChat) SendFile ¶
SendFile is desined to send contain attachment Message to group or contact. path must exit in local file system.
func (*WeChat) SendTextMsg ¶
SendTextMsg send text message
func (*WeChat) SyncContact ¶
SyncContact with Wechat server.
func (*WeChat) UpateGroupIfNeeded ¶
UpateGroupIfNeeded ...