Documentation ¶
Overview ¶
wecaht bot client
Index ¶
- Constants
- Variables
- func GetID() string
- func GetRequestMsg(msg *MSG) (body string)
- type APIPath
- 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 RequetBody
- type TxtMsgHandler
- type UserListHandler
- type WxClient
- func (wx *WxClient) ApiGetMembernick(wxid, roomid string) (nick *Nick, err error)
- func (wx *WxClient) BoolGroup(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 AGREE_TO_FRIEND_REQUEST = 10000 // 拍一拍
View Source
const ATTATCH_FILE = 5003 // 附件
View Source
const AT_MSG = 550 // 艾特消息
View Source
const CHATROOM_MEMBER = 5010 // 群组成员
View Source
const CHATROOM_MEMBER_NICK = 5020 // 群组成员别名
View Source
const DEBUG_SWITCH = 6000 // 调试模式, 默认关
View Source
const DESTROY_ALL = 9999 //
View Source
const GET_USER_LIST_FAIL = 5002 // 获取失败列表
View Source
const GET_USER_LIST_SUCCSESS = 5001 // 获取成功列表
View Source
const HEART_BEAT = 5005 // 心跳
View Source
const NEW_FRIEND_REQUEST = 37 // 微信好友请求消息
View Source
const PERSONAL_DETAIL = 6550 // 个人资料详情
View Source
const PERSONAL_INFO = 6500 // 个人资料
View Source
const PIC_MSG = 500 // 图片消息
View Source
const RECV_PIC_MSG = 3 // 收到的图片消息
View Source
const RECV_TXT_MSG = 1 // 收到的文本消息
View Source
const RECV_TXT_REFERENCE_MSG = 49 // 引用消息
View Source
const TXT_MSG = 555 // 文本消息
View Source
const USER_LIST = 5000 // 用户和群组列表
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 TxtMsg TxtMsgHandler PicMsg PicMsgHandler AtMsg AtMsgHandler }
Functions ¶
Types ¶
type APIPath ¶
type APIPath string
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_CHARROOM_MEMBER_LIST_API APIPath = "/api/get_charroom_member_list" // 获取个人信息 GET_PERSONAL_INFO_API APIPath = "/api/get_personal_info" )
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"` 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 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 RequetBody ¶
type RequetBody struct {
Para MSG `json:"para"`
}
type UserListHandler ¶
type UserListHandler func(wx *WxClient, event *EventUserList)
UserListHandler 获取用户列表消息事件
type WxClient ¶
type WxClient struct { RecvWxid string // contains filtered or unexported fields }
func NewConnect ¶
func (*WxClient) ApiGetMembernick ¶
Tip: API接口与ws重复,暂时不考虑实现,需要的参考下面实现即可
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.