Documentation ¶
Overview ¶
wechat-bot dll client
Index ¶
- Constants
- Variables
- func GetID() string
- func GetRequestMsg(msg *MSG) (body string)
- type APIPath
- type AddFriendRequestHandler
- type AgreeToFriendHandler
- type AtMsgHandler
- type ChatRoomMemberHandler
- type ChatRoomMemberNickHandler
- type Event
- type EventChatrooMmember
- type EventChatrooMmemberNick
- type EventPaiyipai
- type EventPicConent
- type EventReferenceConent
- type EventUserList
- type MSG
- type Nick
- type PersonalDetailHandler
- type PersonalInfo
- type PersonalInfoHandler
- type PicMsgHandler
- type ReadyHandler
- type RecvAtMsgHandler
- type RecvPicMsgHandler
- type RecvTxtMsgHandler
- type TxtMsgHandler
- type UserListHandler
- type WxClient
- func (wx *WxClient) ApiGetChatRoomList() (member *EventChatrooMmember, err error)
- func (wx *WxClient) ApiGetMembernick(wxid, roomid string) (nick *Nick, err error)
- func (wx *WxClient) ApiGetPersonalInfo() (info *PersonalInfo, err error)
- func (wx *WxClient) ApiGetUserList() (event *EventUserList, err error)
- func (wx *WxClient) ApiSendAtMsg(wxid, content, roomid string) (event *Event, err error)
- func (wx *WxClient) ApiSendPicMsg(wxid, content string) (event *Event, err error)
- func (wx *WxClient) ApiSendTxtMsg(wxid, content string) (event *Event, err error)
- func (wx *WxClient) BoolGroup(wxid string) bool
- func (wx *WxClient) BoolOfficialAccount(wxid string) bool
- func (wx *WxClient) GetChatRoomMemberList() (i int, err error)
- func (wx *WxClient) GetGroupUserNick(wxid, roomid string) (i int, err error)
- func (wx *WxClient) GetHttpUrl(path APIPath) string
- func (wx *WxClient) GetPersonalDetail(wxid string) (i int, err error)
- func (wx *WxClient) GetPersonalInfo(wxid string) (i int, err error)
- func (wx *WxClient) GetUserList() (i int, err error)
- func (wx *WxClient) GetWsUrl() string
- func (wx *WxClient) RegisterHandlers(handlers ...interface{})
- func (wx *WxClient) Send(msg *MSG) (i int, err error)
- func (wx *WxClient) SendAtMsg(wxid, content, roomid string) (i int, err error)
- func (wx *WxClient) SendPicMsg(wxid, content string) (i int, err error)
- func (wx *WxClient) SendTxtMsg(wxid, content string) (i int, err error)
- func (wx *WxClient) Start()
Constants ¶
View Source
const ( // 心跳 HEART_BEAT = 5005 // 收到的文本消息 RECV_TXT_MSG = 1 // 收到的图片消息 RECV_PIC_MSG = 3 // 引用消息 RECV_TXT_REFERENCE_MSG = 49 // 用户和群组列表 USER_LIST = 5000 // 获取成功列表 GET_USER_LIST_SUCCSESS = 5001 // 获取失败列表 GET_USER_LIST_FAIL = 5002 // 文本消息 TXT_MSG = 555 // 图片消息 PIC_MSG = 500 // 艾特消息 AT_MSG = 550 // 群组成员 CHATROOM_MEMBER = 5010 // 群组成员别名 CHATROOM_MEMBER_NICK = 5020 // 个人资料 PERSONAL_INFO = 6500 // 调试模式, 默认关 DEBUG_SWITCH = 6000 // 个人资料详情 PERSONAL_DETAIL = 6550 // DESTROY_ALL = 9999 // 微信好友请求消息 NEW_FRIEND_REQUEST = 37 // 添加好友,拍一拍 AGREE_TO_FRIEND_REQUEST = 10000 // 附件 ATTATCH_FILE = 5003 )
Variables ¶
View Source
var Handlers struct { Ready ReadyHandler RecvTxtMsg RecvTxtMsgHandler RecvPicMsg RecvPicMsgHandler UserList UserListHandler ChatRoomMember ChatRoomMemberHandler ChatRoomMemberNick ChatRoomMemberNickHandler RecvAtMsg RecvAtMsgHandler PersonalInfo PersonalInfoHandler PersonalDetail PersonalDetailHandler AgreeToFriend AgreeToFriendHandler AddFriendRequest AddFriendRequestHandler TxtMsg TxtMsgHandler PicMsg PicMsgHandler AtMsg AtMsgHandler }
处理事件函数
Functions ¶
Types ¶
type APIPath ¶
type APIPath string
Api路径
const ( // at消息接口 SEND_AT_MSG_API APIPath = "/api/sendatmsg" // 图片消息接口 SEND_PIC_API APIPath = "/api/sendpic" // 发消息 SEND_TXT_MSG_API APIPath = "/api/sendtxtmsg" // 发附件 SEND_ATTATCH_API APIPath = "/api/sendattatch" // 获取别名 GET_MEMBERNICK_API APIPath = "/api/getmembernick" // 获取成员ID GET_MEMBERID_API APIPath = "/api/getmemberid" // 获取通讯录 GET_CONTACTLIST_API APIPath = "/api/getcontactlist" // 获取成员列表 GET_CHATROOM_MEMBER_LIST_API APIPath = "/api/get_charroom_member_list" // 获取个人信息 GET_PERSONAL_INFO_API APIPath = "/api/get_personal_info" )
type AddFriendRequestHandler ¶ added in v1.0.0
AddFriendRequestHandler 获取添加好友事件
type AgreeToFriendHandler ¶
AgreeToFriendHandler 同意好友成功事件
type ChatRoomMemberHandler ¶
type ChatRoomMemberHandler func(wx *WxClient, event *EventChatrooMmember)
ChatRoomMemberHandler 获取群成员事件
type ChatRoomMemberNickHandler ¶
type ChatRoomMemberNickHandler func(wx *WxClient, event *EventChatrooMmemberNick)
ChatRoomMemberNickHandler 获取成员具体昵称事件
type Event ¶
type Event struct { ID string `json:"id"` ID1 string `json:"id1"` // 发送人 ID2 string `json:"id2"` // ID3 string `json:"id3"` Type int32 `json:"type"` Content string `json:"content"` Receiver string `json:"receiver"` Sender string `json:"sender"` Srvid int8 `json:"srvid"` Status string `json:"status"` Time string `json:"time"` Wxid string `json:"wxid"` // 发送人 | 群ID }
消息事件
type EventChatrooMmember ¶
type EventChatrooMmember struct { ID string `json:"id"` Type int32 `json:"type"` Content []struct { Address string `json:"address"` Member []string `json:"member"` RoomID string `json:"room_id"` } `json:"content"` }
chatroom member 5010
type EventChatrooMmemberNick ¶
type EventChatrooMmemberNick struct { ID string `json:"id"` Type int32 `json:"type"` Content Nick `json:"content"` Receiver string `json:"receiver"` Sender string `json:"sender"` Srvid int8 `json:"srvid"` Status string `json:"status"` Time string `json:"time"` }
chatroom member nickname 5020
type EventPaiyipai ¶
type EventPaiyipai struct { ID string `json:"id"` Type int32 `json:"type"` Content struct { Content string `json:"content"` ID1 string `json:"id1"` // 发送人 | 群ID } `json:"content"` Receiver string `json:"receiver"` Sender string `json:"sender"` Srvid int8 `json:"srvid"` Status string `json:"status"` Time string `json:"time"` }
拍一拍 || 添加好友
type EventPicConent ¶
type EventPicConent struct { ID string `json:"id"` Type int32 `json:"type"` Content struct { Content string `json:"content"` Detail string `json:"detail"` // 图片详情 ID1 string `json:"id1"` // 发送人 | 群ID ID2 string `json:"id2"` // Thumb string `json:"thumb"` // 缩略图 } `json:"content"` Receiver string `json:"receiver"` Sender string `json:"sender"` Srvid int8 `json:"srvid"` Status string `json:"status"` Time string `json:"time"` }
图片消息事件 3
type EventReferenceConent ¶
type EventReferenceConent struct { ID string `json:"id"` Type int32 `json:"type"` Content struct { Content string `json:"content"` ID1 string `json:"id1"` // 发送人 ID2 string `json:"id2"` // } `json:"content"` Receiver string `json:"receiver"` Sender string `json:"sender"` Srvid int8 `json:"srvid"` Status string `json:"status"` Time string `json:"time"` }
引用消息事件 49
type EventUserList ¶
type EventUserList struct { ID string `json:"id"` Type int32 `json:"type"` Content []struct { Headimg string `json:"headimg"` Name string `json:"name"` Node int32 `json:"node"` Remarks string `json:"remarks"` Wxcode string `json:"wxcode"` // 微信号 Wxid string `json:"wxid"` // 微信id } `json:"content"` }
user_list 5000
type MSG ¶
type MSG struct { ID string `json:"id"` Type int32 `json:"type"` Roomid string `json:"roomid"` Wxid string `json:"wxid"` Content string `json:"content"` Nickname string `json:"nickname"` Ext interface{} `json:"ext"` }
消息主体
type PersonalDetailHandler ¶
PersonalDetailHandler 获取个人详细资料事件
type PersonalInfo ¶
type PersonalInfo struct { Code string `json:"wx_code"` Id string `json:"wx_id"` Name string `json:"wx_name"` }
个人资料
type PersonalInfoHandler ¶
PersonalInfoHandler 获取个人资料事件
type RecvAtMsgHandler ¶
RecvAtMsgHandler 获取接收At消息事件
type RecvPicMsgHandler ¶
RecvPicMsgHandler 获取接收图片消息事件
type RecvTxtMsgHandler ¶
RecvTxtMsgHandler 获取接收文本消息事件
type UserListHandler ¶
type UserListHandler func(wx *WxClient, event *EventUserList)
UserListHandler 获取用户列表消息事件
type WxClient ¶
type WxClient struct { RecvWxid string // contains filtered or unexported fields }
func (*WxClient) ApiGetChatRoomList ¶ added in v1.0.0
func (wx *WxClient) ApiGetChatRoomList() (member *EventChatrooMmember, err error)
获取群列表
func (*WxClient) ApiGetMembernick ¶
获取群成员昵称
func (*WxClient) ApiGetPersonalInfo ¶ added in v1.0.0
func (wx *WxClient) ApiGetPersonalInfo() (info *PersonalInfo, err error)
获取个人资料
func (*WxClient) ApiGetUserList ¶ added in v1.0.0
func (wx *WxClient) ApiGetUserList() (event *EventUserList, err error)
获取好友列表
func (*WxClient) ApiSendAtMsg ¶ added in v1.0.0
群里发at消息
func (*WxClient) ApiSendPicMsg ¶ added in v1.0.0
发送图片消息
func (*WxClient) ApiSendTxtMsg ¶ added in v1.0.0
发送文本消息
func (*WxClient) BoolOfficialAccount ¶ added in v1.0.1
判断是否为公众号
func (*WxClient) GetChatRoomMemberList ¶
获取群列表
func (*WxClient) GetGroupUserNick ¶
获取群成员昵称
func (*WxClient) GetPersonalDetail ¶
获取详细资料
func (*WxClient) GetPersonalInfo ¶
获取个人信息
func (*WxClient) RegisterHandlers ¶
func (wx *WxClient) RegisterHandlers(handlers ...interface{})
RegisterHandlers 注册事件回调
func (*WxClient) SendPicMsg ¶
发图片消息
func (*WxClient) SendTxtMsg ¶
发文本消息
Click to show internal directories.
Click to hide internal directories.