Documentation ¶
Index ¶
- func MkAtContent(req *SendMsgReq)
- type AddFavResp
- type Bot
- func (bot *Bot) AcceptTransfer(rawMsgData Msg) (*ExternalMsgResp, error)
- func (bot *Bot) AcceptUser(stranger, ticket string) (*MsgAndStatus, error)
- func (bot *Bot) AddContact(stranger, ticket, content string, Type int) (*MsgAndStatus, error)
- func (bot *Bot) AddFav(content string) (*AddFavResp, error)
- func (bot *Bot) AddLabel(label string) (*MsgAndStatus, error)
- func (bot *Bot) AddRoomMember(groupID, userID string) (*MsgAndStatus, error)
- func (bot *Bot) Close() CommandResp
- func (bot *Bot) CloseWS()
- func (bot *Bot) CreateRoom(userList []string) (*CreateRoomResp, error)
- func (bot *Bot) DeleteContact(userID string) (*MsgAndStatus, error)
- func (bot *Bot) DeleteFav(favID int) (*FavResp, error)
- func (bot *Bot) DeleteLabel(labelID int) (*MsgAndStatus, error)
- func (bot *Bot) DeleteRoomMember(groupID, userID string) (*MsgAndStatus, error)
- func (bot *Bot) GetContact(userID string) (*Contact, error)
- func (bot *Bot) GetFav(favID int) (*FavResp, error)
- func (bot *Bot) GetLabelList() (*LabelListResp, error)
- func (bot *Bot) GetLoginToken() (*LoginTokenResp, error)
- func (bot *Bot) GetMsgImage(rawMsgData Msg) (*MsgImageResp, error)
- func (bot *Bot) GetMsgVideo(rawMsgData Msg) (*MsgVideoResp, error)
- func (bot *Bot) GetMsgVoice(rawMsgData Msg) (*MsgVoiceResp, error)
- func (bot *Bot) GetMyInfo() (*MyInfoResp, error)
- func (bot *Bot) GetRequestToken(ghName, url string) (*RequestTokenResp, error)
- func (bot *Bot) GetRoomMembers(groupID string) (*ChatroomInfo, error)
- func (bot *Bot) GetRoomQRCode(groupID string) (*QRCodeResp, error)
- func (bot *Bot) GetSubscriptionInfo(ghName string) (*SearchMPResp, error)
- func (bot *Bot) GetUserQRCode(userID string, style int) (*QRCodeResp, error)
- func (bot *Bot) GetWXData() (string, error)
- func (bot *Bot) Init() CommandResp
- func (bot *Bot) InviteRoomMember(groupID, userID string) (*MsgAndStatus, error)
- func (bot *Bot) Logout() CommandResp
- func (bot *Bot) OnClose(f func(code int, text string) error)
- func (bot *Bot) OnContactSync(f func(contact Contact))
- func (bot *Bot) OnLoaded(f func())
- func (bot *Bot) OnLogin(f func())
- func (bot *Bot) OnMsg(f func(msg Msg))
- func (bot *Bot) OnQRURL(f func(string))
- func (bot *Bot) OnScan(f func(resp ScanResp))
- func (bot *Bot) OnWarn(f func(err string))
- func (bot *Bot) OpenRedPacket(rawMsgData Msg, key string) (*ExternalMsgResp, error)
- func (bot *Bot) OperateSubscription(ghName string, menuId int, menuKey string) (*MsgAndStatus, error)
- func (bot *Bot) PhoneLogin(wxData, phone, code string) CommandResp
- func (bot *Bot) QRLogin() CommandResp
- func (bot *Bot) QueryRedPacket(rawMsgData Msg, index int) (*ExternalMsgResp, error)
- func (bot *Bot) QueryTransfer(rawMsgData Msg) (*ExternalMsgResp, error)
- func (bot *Bot) QuitRoom(groupID string) (*MsgAndStatus, error)
- func (bot *Bot) ReceiveRedPacket(rawMsgData Msg) (*ExternalMsgResp, error)
- func (bot *Bot) RequestLogin(wxData, token string) CommandResp
- func (bot *Bot) RequestUrl(url, xKey, xUin string) (*RequestUrlResp, error)
- func (bot *Bot) SNSComment(userID, momentID, content string) (*MomentDetailResp, error)
- func (bot *Bot) SNSGetObject(momentID string) (*MomentDetailResp, error)
- func (bot *Bot) SNSLike(userID, momentID string) (*MomentDetailResp, error)
- func (bot *Bot) SNSObjectOperation(momentID, commentID string, Type, commentType int) (*MsgAndStatus, error)
- func (bot *Bot) SNSSendMoment(content string) (*MomentResp, error)
- func (bot *Bot) SNSTimeLine(momentID string) (*MomentListResp, error)
- func (bot *Bot) SNSUpload(file string) (*SNSUploadResp, error)
- func (bot *Bot) SNSUserPage(userID, momentID string) (*MomentListResp, error)
- func (bot *Bot) SayHello(stranger, ticket, content string) (*MsgAndStatus, error)
- func (bot *Bot) SearchContact(userID string) (*Contact, error)
- func (bot *Bot) SearchMp(content string) (*SearchMPResp, error)
- func (bot *Bot) SendImage(req SendMsgReq) (*SendMsgResp, error)
- func (bot *Bot) SendMsg(req *SendMsgReq) (*SendMsgResp, error)
- func (bot *Bot) SetCommandTimeout(t time.Duration)
- func (bot *Bot) SetHeadImg(file string) (*ImgResp, error)
- func (bot *Bot) SetLabel(userID string, labelID int) (*MsgAndStatus, error)
- func (bot *Bot) SetRemark(userID, remark string) (*MsgAndStatus, error)
- func (bot *Bot) SetRoomAnnouncement(groupID, content string) (*MsgAndStatus, error)
- func (bot *Bot) SetRoomName(groupID, content string) (*MsgAndStatus, error)
- func (bot *Bot) ShareCard(toUserName, content, userId string) (*SendMsgResp, error)
- func (bot *Bot) SyncContact() CommandResp
- func (bot *Bot) SyncFav(favKey string) (*FavListResp, error)
- func (bot *Bot) SyncMsg() CommandResp
- func (bot *Bot) TokenLogin(wxData, token string) CommandResp
- func (bot *Bot) UserLogin(wxData, username, password string) CommandResp
- type ChatMemberInfo
- type ChatroomInfo
- type CommandResp
- type Contact
- type CreateRoomResp
- type ExternalMsgResp
- type Fav
- type FavDetail
- type FavListResp
- type FavResp
- type ImgResp
- type Label
- type LabelListResp
- type LoginReq
- type LoginTokenResp
- type Moment
- type MomentComment
- type MomentDetail
- type MomentDetailResp
- type MomentLike
- type MomentListResp
- type MomentResp
- type Msg
- type MsgAndStatus
- type MsgImageResp
- type MsgVideoResp
- type MsgVoiceResp
- type MyInfoResp
- type PushResp
- type QRCodeResp
- type RequestTokenResp
- type RequestUrlResp
- type SNSUploadResp
- type ScanResp
- type SearchMPResp
- type SendMsgReq
- type SendMsgResp
- type ServerData
- type WSConn
- type WSReq
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MkAtContent ¶
func MkAtContent(req *SendMsgReq)
MkAtContent prefix 'at' symbol for req content if necessary
Types ¶
type AddFavResp ¶
type Bot ¶
func (*Bot) AcceptTransfer ¶
func (bot *Bot) AcceptTransfer(rawMsgData Msg) (*ExternalMsgResp, error)
AcceptTransfer 接受转账 mType = 49 使用 bytes.Contains(msg.Content, []byte("<![CDATA[微信转账]]>")) 与红包区分
func (*Bot) AcceptUser ¶
func (bot *Bot) AcceptUser(stranger, ticket string) (*MsgAndStatus, error)
AcceptUser 通过好友验证
func (*Bot) AddContact ¶
func (bot *Bot) AddContact(stranger, ticket, content string, Type int) (*MsgAndStatus, error)
AddContact 添加好友 0: 通过微信号搜索 1: 搜索QQ号 3: 通过微信号搜索 4: 通过QQ好友添加 8: 通过群聊 12: 来自QQ好友 14: 通过群聊 15: 通过搜索手机号 17: 通过名片分享 22: 通过摇一摇打招呼方式 25: 通过漂流瓶 30: 通过二维码方式
func (*Bot) AddRoomMember ¶
func (bot *Bot) AddRoomMember(groupID, userID string) (*MsgAndStatus, error)
AddRoomMember 添加群成员
func (*Bot) CreateRoom ¶
func (bot *Bot) CreateRoom(userList []string) (*CreateRoomResp, error)
CreateRoom 创建群
func (*Bot) DeleteContact ¶
func (bot *Bot) DeleteContact(userID string) (*MsgAndStatus, error)
DeleteContact 删除好友
func (*Bot) DeleteLabel ¶
func (bot *Bot) DeleteLabel(labelID int) (*MsgAndStatus, error)
DeleteLabel 删除标签
func (*Bot) DeleteRoomMember ¶
func (bot *Bot) DeleteRoomMember(groupID, userID string) (*MsgAndStatus, error)
DeleteRoomMember 删除群成员
func (*Bot) GetContact ¶
GetContact 获取用户/群信息
func (*Bot) GetLabelList ¶
func (bot *Bot) GetLabelList() (*LabelListResp, error)
GetLabelList 获取所有标签
func (*Bot) GetLoginToken ¶
func (bot *Bot) GetLoginToken() (*LoginTokenResp, error)
GetLoginToken 获取二次登陆数据
func (*Bot) GetMsgImage ¶
func (bot *Bot) GetMsgImage(rawMsgData Msg) (*MsgImageResp, error)
GetMsgImage 获取消息原始图片 mType = 3
func (*Bot) GetMsgVideo ¶
func (bot *Bot) GetMsgVideo(rawMsgData Msg) (*MsgVideoResp, error)
GetMsgVideo 获取消息原始视频 mType = 43
func (*Bot) GetMsgVoice ¶
func (bot *Bot) GetMsgVoice(rawMsgData Msg) (*MsgVoiceResp, error)
GetMsgVoice 获取消息语音数据 mType = 34
func (*Bot) GetRequestToken ¶
func (bot *Bot) GetRequestToken(ghName, url string) (*RequestTokenResp, error)
GetRequestToken 获取网页访问授权
func (*Bot) GetRoomMembers ¶
func (bot *Bot) GetRoomMembers(groupID string) (*ChatroomInfo, error)
GetRoomMembers 获取群成员信息
func (*Bot) GetRoomQRCode ¶
func (bot *Bot) GetRoomQRCode(groupID string) (*QRCodeResp, error)
GetRoomQRCode 获取微信群二维码
func (*Bot) GetSubscriptionInfo ¶
func (bot *Bot) GetSubscriptionInfo(ghName string) (*SearchMPResp, error)
GetSubscriptionInfo 获取公众号信息
func (*Bot) GetUserQRCode ¶
func (bot *Bot) GetUserQRCode(userID string, style int) (*QRCodeResp, error)
GetUserQRCode 获取用户二维码, 仅限获取自己的二维码, 无法获取其他人的二维码
func (*Bot) InviteRoomMember ¶
func (bot *Bot) InviteRoomMember(groupID, userID string) (*MsgAndStatus, error)
InviteRoomMember 邀请群成员, 会给对方发送一条邀请消息, 无法判断对方是否真的接收到
func (*Bot) OnContactSync ¶
OnContactSync 联系人同步回调
func (*Bot) OpenRedPacket ¶
func (bot *Bot) OpenRedPacket(rawMsgData Msg, key string) (*ExternalMsgResp, error)
OpenRedPacket 领取红包
func (*Bot) OperateSubscription ¶
func (bot *Bot) OperateSubscription(ghName string, menuId int, menuKey string) (*MsgAndStatus, error)
OperateSubscription 操作公众号菜单
func (*Bot) PhoneLogin ¶
func (bot *Bot) PhoneLogin(wxData, phone, code string) CommandResp
PhoneLogin 手机验证码登录
func (*Bot) QueryRedPacket ¶
func (bot *Bot) QueryRedPacket(rawMsgData Msg, index int) (*ExternalMsgResp, error)
QueryRedPacket 查看红包信息, 如果是别人发的红包, 未领取且未领取完毕时, 无法取到红包信息
func (*Bot) QueryTransfer ¶
func (bot *Bot) QueryTransfer(rawMsgData Msg) (*ExternalMsgResp, error)
QueryTransfer 查看转账消息
func (*Bot) ReceiveRedPacket ¶
func (bot *Bot) ReceiveRedPacket(rawMsgData Msg) (*ExternalMsgResp, error)
ReceiveRedPacket 接收红包 mType = 49 使用 bytes.Contains(msg.Content, []byte("<![CDATA[微信红包]]>")) 与转账区分
func (*Bot) RequestLogin ¶
func (bot *Bot) RequestLogin(wxData, token string) CommandResp
RequestLogin 二次登陆, 手机端会弹出确认框, 点击后登陆, 不容易封号
func (*Bot) RequestUrl ¶
func (bot *Bot) RequestUrl(url, xKey, xUin string) (*RequestUrlResp, error)
RequestUrl 访问网页
func (*Bot) SNSComment ¶
func (bot *Bot) SNSComment(userID, momentID, content string) (*MomentDetailResp, error)
SNSComment 评论朋友圈
func (*Bot) SNSGetObject ¶
func (bot *Bot) SNSGetObject(momentID string) (*MomentDetailResp, error)
SNSGetObject 获取朋友圈信息详情
func (*Bot) SNSLike ¶
func (bot *Bot) SNSLike(userID, momentID string) (*MomentDetailResp, error)
SNSLike 朋友圈点赞
func (*Bot) SNSObjectOperation ¶
func (bot *Bot) SNSObjectOperation(momentID, commentID string, Type, commentType int) (*MsgAndStatus, error)
SNSObjectOperation 操作朋友圈 type - 操作类型,1为删除朋友圈,4为删除评论,5为取消赞 commentType - 操作类型,当删除评论时可用,需与评论type字段一致
func (*Bot) SNSSendMoment ¶
func (bot *Bot) SNSSendMoment(content string) (*MomentResp, error)
SNSSendMoment 发朋友圈 content - 文本内容或 TimeLineObject 结构体文本
func (*Bot) SNSTimeLine ¶
func (bot *Bot) SNSTimeLine(momentID string) (*MomentListResp, error)
SNSTimeLine 查看朋友圈动态 momentID 首次传入空即获取第一页, 以后传入上次拉取的最后一条信息ID
func (*Bot) SNSUpload ¶
func (bot *Bot) SNSUpload(file string) (*SNSUploadResp, error)
SNSUpload 上传图片到朋友圈 此接口只能上传图片,并不会将图片发到朋友圈中
func (*Bot) SNSUserPage ¶
func (bot *Bot) SNSUserPage(userID, momentID string) (*MomentListResp, error)
SNSUserPage 查看用户朋友圈 momentID 首次传入空即获取第一页, 以后传入上次拉取的最后一条信息ID
func (*Bot) SayHello ¶
func (bot *Bot) SayHello(stranger, ticket, content string) (*MsgAndStatus, error)
SayHello 打招呼,如果已经是好友, 会收到由系统自动发送, 来自对方的一条文本信息 "xx已通过你的朋友验证请求,现在可以开始聊天了"
func (*Bot) SearchContact ¶
SearchContact 搜索用户
func (*Bot) SearchMp ¶
func (bot *Bot) SearchMp(content string) (*SearchMPResp, error)
SearchMp 搜索公众号
func (*Bot) SendImage ¶
func (bot *Bot) SendImage(req SendMsgReq) (*SendMsgResp, error)
SendImage 发送图片消息, file 为图片 base64 数据
func (*Bot) SetCommandTimeout ¶
SetCommandTimeout 设置微信指令超时时间, 默认为 30 秒
func (*Bot) SetLabel ¶
func (bot *Bot) SetLabel(userID string, labelID int) (*MsgAndStatus, error)
SetLabel 设置用户标签
func (*Bot) SetRemark ¶
func (bot *Bot) SetRemark(userID, remark string) (*MsgAndStatus, error)
SetRemark 设置备注
func (*Bot) SetRoomAnnouncement ¶
func (bot *Bot) SetRoomAnnouncement(groupID, content string) (*MsgAndStatus, error)
SetRoomAnnouncement 设置群公告
func (*Bot) SetRoomName ¶
func (bot *Bot) SetRoomName(groupID, content string) (*MsgAndStatus, error)
SetRoomName 设置群名称
func (*Bot) ShareCard ¶
func (bot *Bot) ShareCard(toUserName, content, userId string) (*SendMsgResp, error)
ShareCard 分享名片
func (*Bot) SyncMsg ¶
func (bot *Bot) SyncMsg() CommandResp
SyncMsg 同步消息, 使用此接口手动触发同步消息, 一般用于刚登陆后调用, 可立即开始同步消息. 否则会在有新消息时才开始同步消息.
func (*Bot) TokenLogin ¶
func (bot *Bot) TokenLogin(wxData, token string) CommandResp
TokenLogin 断线重连, 用于短时间使用 `wxData` 和 `token` 再次登录 `token`有效期很短, 如果登陆失败, 建议使用二次登陆方式
func (*Bot) UserLogin ¶
func (bot *Bot) UserLogin(wxData, username, password string) CommandResp
UserLogin 账号密码登录
type ChatMemberInfo ¶
type ChatroomInfo ¶
type CommandResp ¶
type CommandResp struct { Success bool Data json.RawMessage Msg string }
type Contact ¶
type Contact struct { BigHead string `json:"big_head"` BitMask int64 `json:"bit_mask"` BitValue int `json:"bit_value"` ChatroomID int `json:"chatroom_id"` ChatroomOwner string `json:"chatroom_owner"` City string `json:"city"` Continue int `json:"continue"` Country string `json:"country"` ID int `json:"id"` ImgFlag int `json:"img_flag"` Intro string `json:"intro"` Label string `json:"label"` Level int `json:"level"` Member string `json:"member"` MaxMemberCount int `json:"max_member_count"` MemberCount int `json:"member_count"` MsgType int `json:"msg_type"` NickName string `json:"nick_name"` Provincia string `json:"provincia"` PyInitial string `json:"py_initial"` QuanPin string `json:"quan_pin"` Remark string `json:"remark"` RemarkPyInitial string `json:"remark_py_initial"` RemarkQuanPin string `json:"remark_quan_pin"` Sex int `json:"sex"` Signature string `json:"signature"` SmallHead string `json:"small_head"` Source int `json:"source"` Status int `json:"status"` Stranger string `json:"stranger"` Uin int `json:"uin"` UserName string `json:"user_name"` }
type CreateRoomResp ¶
type ExternalMsgResp ¶
type FavListResp ¶
type LabelListResp ¶
type LoginTokenResp ¶
type MomentComment ¶
type MomentComment struct { CommentFlag int `json:"comment_flag"` Content string `json:"content"` CreateTime int `json:"create_time"` DeleteFlag int `json:"delete_flag"` ID int `json:"id"` NickName string `json:"nick_name"` ReplyID int `json:"reply_id"` ReplyUserName string `json:"reply_user_name"` Source int `json:"source"` Type int `json:"type"` UserName string `json:"user_name"` }
type MomentDetail ¶
type MomentDetail struct { Comment []MomentComment `json:"comment"` CreateTime int `json:"create_time"` Description string `json:"description"` ID string `json:"id"` Like []MomentLike `json:"like"` NickName string `json:"nick_name"` UserName string `json:"user_name"` }
type MomentDetailResp ¶
type MomentDetailResp struct { Data MomentDetail `json:"data"` Message string `json:"message"` Status int `json:"status"` }
type MomentLike ¶
type MomentListResp ¶
type MomentResp ¶
type Msg ¶
type Msg struct { Data string `json:"data,omitempty"` Content json.RawMessage `json:"content"` Continue int `json:"continue"` Description string `json:"description"` Status int `json:"status"` Timestamp int `json:"timestamp"` Uin int `json:"uin"` FromUser string `json:"from_user"` MsgID string `json:"msg_id"` MsgSource string `json:"msg_source"` MsgType int `json:"msg_type"` SubType int `json:"sub_type"` ToUser string `json:"to_user"` MType int `json:"m_type"` }
type MsgAndStatus ¶
type MsgImageResp ¶
type MsgVideoResp ¶
type MsgVoiceResp ¶
type MyInfoResp ¶
type PushResp ¶
type PushResp struct {
List []json.RawMessage `json:"list"`
}
type QRCodeResp ¶
type RequestTokenResp ¶
type RequestUrlResp ¶
type SNSUploadResp ¶
type ScanResp ¶
type ScanResp struct { DeviceType string `json:"device_type"` ExpiredTime int `json:"expired_time"` HeadURL string `json:"head_url"` NickName string `json:"nick_name"` Password string `json:"password"` Status int `json:"status"` UserName string `json:"user_name"` External string `json:"external"` Email string `json:"email"` Uin int `json:"uin"` PhoneNumber string `json:"phone_number"` SubStatus int `json:"sub_status"` }