Documentation
¶
Index ¶
- Constants
- func ParsePackedInfo(b []byte) *wxproto.PackedInfo
- type App
- type AppAttach
- type ChatRoom
- type ChatRoomUser
- type ChatRoomV4
- type Contact
- type ContactV4
- type ContentTemplate
- type DataItem
- type DataItemLocation
- type DataList
- type DelChatRoomMember
- type Emoji
- type FinderFeed
- type FinderLive
- type FinderLiveMedia
- type FinderLiveMediaCoverURL
- type FinderMedia
- type FinderMediaList
- type FinderMegaVideo
- type Image
- type Link
- type LinkList
- type Location
- type Media
- type MediaMsg
- type MediaV4
- type Member
- type MemberList
- type Message
- type MessageV4
- type PatInfo
- type PatMsg
- type PatRecord
- type QRLink
- type QRMemberList
- type RecordInfo
- type RecordItem
- type RecordXML
- type Records
- type ReferMsg
- type RevokeMsg
- type Session
- type SessionV4
- type SysMsg
- type SysMsgTemplate
- type UsernameItem
- type Video
- type WCPayInfo
Constants ¶
const ( // MessageTypeText 文本 MessageTypeText = 1 // MessageTypeImage 图片 MessageTypeImage = 3 // MessageTypeVoice 语音 MessageTypeVoice = 34 // MessageTypeCard 名片 MessageTypeCard = 42 // MessageTypeVideo 视频 MessageTypeVideo = 43 // MessageTypeAnimation 动画表情 MessageTypeAnimation = 47 // MessageTypeLocation 位置 MessageTypeLocation = 48 MessageTypeShare = 49 // MessageTypeVOIP 语音通话 MessageTypeVOIP = 50 // MessageTypeSystem 系统 MessageTypeSystem = 10000 )
const ( // MessageSubTypeText 文本 MessageSubTypeText = 1 // MessageSubTypeLink 链接分享 MessageSubTypeLink = 4 // MessageSubTypeLink2 链接分享 MessageSubTypeLink2 = 5 // MessageSubTypeFile 文件 MessageSubTypeFile = 6 // MessageSubTypeGIF 动图 MessageSubTypeGIF = 8 // MessageSubTypeMergeForward 合并转发 MessageSubTypeMergeForward = 19 // MessageSubTypeNote 笔记 MessageSubTypeNote = 24 // MessageSubTypeMiniProgram 小程序 MessageSubTypeMiniProgram = 33 // MessageSubTypeMiniProgram2 小程序 MessageSubTypeMiniProgram2 = 36 // MessageSubTypeChannel 视频号 MessageSubTypeChannel = 51 // MessageSubTypeQuote 引用 MessageSubTypeQuote = 57 // MessageSubTypePat 拍一拍 MessageSubTypePat = 62 // MessageSubTypeChannelLive 视频号直播 MessageSubTypeChannelLive = 63 // MessageSubTypeChatRoomNotice 群公告 MessageSubTypeChatRoomNotice = 87 // MessageSubTypeMusic 音乐 MessageSubTypeMusic = 92 // MessageSubTypePay 转账 MessageSubTypePay = 2000 // MessageSubTypeRedEnvelope 红包 MessageSubTypeRedEnvelope = 2001 // MessageSubTypeRedEnvelopeCover 红包封面 MessageSubTypeRedEnvelopeCover = 2003 )
const (
WeChatV4 = "wechatv4"
)
Variables ¶
This section is empty.
Functions ¶
func ParsePackedInfo ¶
func ParsePackedInfo(b []byte) *wxproto.PackedInfo
Types ¶
type App ¶
type App struct {
Type int `xml:"type"`
Title string `xml:"title"`
Des string `xml:"des"`
URL string `xml:"url"` // type 5 分享
AppAttach *AppAttach `xml:"appattach,omitempty"` // type 6 文件
MD5 string `xml:"md5,omitempty"` // type 6 文件
RecordItem *RecordItem `xml:"recorditem,omitempty"` // type 19 合并转发
SourceDisplayName string `xml:"sourcedisplayname,omitempty"` // type 33 小程序
FinderFeed *FinderFeed `xml:"finderFeed,omitempty"` // type 51 视频号
ReferMsg *ReferMsg `xml:"refermsg,omitempty"` // type 57 引用
PatMsg *PatMsg `xml:"patMsg,omitempty"` // type 62 拍一拍
PatInfo *PatInfo `xml:"patinfo,omitempty"` // type 62 拍一拍 v2
FinderLive *FinderLive `xml:"finderLive,omitempty"` // type 63 视频号直播
WCPayInfo *WCPayInfo `xml:"wcpayinfo,omitempty"` // type 2000 微信转账
}
type AppAttach ¶
type AppAttach struct {
TotalLen string `xml:"totallen"`
AttachID string `xml:"attachid"`
CDNAttachURL string `xml:"cdnattachurl"`
EmoticonMD5 string `xml:"emoticonmd5"`
AESKey string `xml:"aeskey"`
FileExt string `xml:"fileext"`
IsLargeFileMsg string `xml:"islargefilemsg"`
}
AppAttach 表示应用附件
type ChatRoom ¶
type ChatRoom struct {
Name string `json:"name"`
Owner string `json:"owner"`
Users []ChatRoomUser `json:"users"`
// Extra From Contact
Remark string `json:"remark"`
NickName string `json:"nickName"`
User2DisplayName map[string]string `json:"-"`
}
func (*ChatRoom) DisplayName ¶
type ChatRoomUser ¶
type ChatRoomUser struct {
UserName string `json:"userName"`
DisplayName string `json:"displayName"`
}
func ParseRoomData ¶
func ParseRoomData(b []byte) (users []ChatRoomUser)
type ChatRoomV4 ¶
type ChatRoomV4 struct {
ID int `json:"id"`
UserName string `json:"username"`
Owner string `json:"owner"`
ExtBuffer []byte `json:"ext_buffer"`
}
CREATE TABLE chat_room( id INTEGER PRIMARY KEY, username TEXT, owner TEXT, ext_buffer BLOB )
func (*ChatRoomV4) Wrap ¶
func (c *ChatRoomV4) Wrap() *ChatRoom
type Contact ¶
type Contact struct {
UserName string `json:"userName"`
Alias string `json:"alias"`
Remark string `json:"remark"`
NickName string `json:"nickName"`
IsFriend bool `json:"isFriend"`
}
func (*Contact) DisplayName ¶
type ContactV4 ¶
type ContactV4 struct {
UserName string `json:"username"`
Alias string `json:"alias"`
Remark string `json:"remark"`
NickName string `json:"nick_name"`
LocalType int `json:"local_type"` // 2 群聊; 3 群聊成员(非好友); 5,6 企业微信;
}
CREATE TABLE contact( id INTEGER PRIMARY KEY, username TEXT, local_type INTEGER, alias TEXT, encrypt_username TEXT, flag INTEGER, delete_flag INTEGER, verify_flag INTEGER, remark TEXT, remark_quan_pin TEXT, remark_pin_yin_initial TEXT, nick_name TEXT, pin_yin_initial TEXT, quan_pin TEXT, big_head_url TEXT, small_head_url TEXT, head_img_md5 TEXT, chat_room_notify INTEGER, is_in_chat_room INTEGER, description TEXT, extra_buffer BLOB, chat_room_type INTEGER )
type ContentTemplate ¶
type DataItem ¶
type DataItem struct {
DataType string `xml:"datatype,attr,omitempty"`
DataID string `xml:"dataid,attr,omitempty"`
HTMLID string `xml:"htmlid,attr,omitempty"`
DataFmt string `xml:"datafmt,omitempty"`
SourceName string `xml:"sourcename,omitempty"`
SourceTime string `xml:"sourcetime,omitempty"`
SourceHeadURL string `xml:"sourceheadurl,omitempty"`
DataDesc string `xml:"datadesc,omitempty"`
// 图片特有字段
ThumbSourcePath string `xml:"thumbsourcepath,omitempty"`
ThumbSize string `xml:"thumbsize,omitempty"`
CDNDataURL string `xml:"cdndataurl,omitempty"`
CDNDataKey string `xml:"cdndatakey,omitempty"`
CDNThumbURL string `xml:"cdnthumburl,omitempty"`
CDNThumbKey string `xml:"cdnthumbkey,omitempty"`
DataSourcePath string `xml:"datasourcepath,omitempty"`
FullMD5 string `xml:"fullmd5,omitempty"`
ThumbFullMD5 string `xml:"thumbfullmd5,omitempty"`
ThumbHead256MD5 string `xml:"thumbhead256md5,omitempty"`
DataSize string `xml:"datasize,omitempty"`
CDNEncryVer string `xml:"cdnencryver,omitempty"`
SrcChatname string `xml:"srcChatname,omitempty"`
SrcMsgLocalID string `xml:"srcMsgLocalid,omitempty"`
SrcMsgCreateTime string `xml:"srcMsgCreateTime,omitempty"`
MessageUUID string `xml:"messageuuid,omitempty"`
FromNewMsgID string `xml:"fromnewmsgid,omitempty"`
// 链接
Link string `xml:"link,omitempty"`
// 音乐
StreamWebURL string `xml:"streamweburl,omitempty"`
// 位置
Location DataItemLocation `xml:"location,omitempty"`
// 套娃合并转发
DataTitle string `xml:"datatitle,omitempty"`
RecordXML *RecordXML `xml:"recordxml,omitempty"`
}
DataItem 表示数据项
type DataItemLocation ¶
type DataList ¶
type DataList struct {
Count string `xml:"count,attr,omitempty"`
DataItems []DataItem `xml:"dataitem,omitempty"`
}
DataList 表示数据列表
type DelChatRoomMember ¶
type DelChatRoomMember struct {
Plain string `xml:"plain"`
Text string `xml:"text"`
Link QRLink `xml:"link"`
}
第一种消息类型:删除群成员/二维码邀请
type Emoji ¶
type Emoji struct {
FromUsername string `xml:"fromusername,attr"`
ToUsername string `xml:"tousername,attr"`
Type string `xml:"type,attr"`
IdBuffer string `xml:"idbuffer,attr"`
Md5 string `xml:"md5,attr"`
Len string `xml:"len,attr"`
CdnURL string `xml:"cdnurl,attr"`
AesKey string `xml:"aeskey,attr"`
Width string `xml:"width,attr"`
Height string `xml:"height,attr"`
}
type FinderFeed ¶
type FinderFeed struct {
ObjectID string `xml:"objectId"`
FeedType string `xml:"feedType"`
Nickname string `xml:"nickname"`
Avatar string `xml:"avatar"`
Desc string `xml:"desc"`
MediaCount string `xml:"mediaCount"`
ObjectNonceID string `xml:"objectNonceId"`
LiveID string `xml:"liveId"`
Username string `xml:"username"`
AuthIconURL string `xml:"authIconUrl"`
AuthIconType int `xml:"authIconType"`
ContactJumpInfoStr string `xml:"contactJumpInfoStr"`
SourceCommentScene int `xml:"sourceCommentScene"`
MediaList FinderMediaList `xml:"mediaList"`
MegaVideo FinderMegaVideo `xml:"megaVideo"`
BizUsername string `xml:"bizUsername"`
BizNickname string `xml:"bizNickname"`
BizAvatar string `xml:"bizAvatar"`
BizUsernameV2 string `xml:"bizUsernameV2"`
BizAuthIconURL string `xml:"bizAuthIconUrl"`
BizAuthIconType int `xml:"bizAuthIconType"`
EcSource string `xml:"ecSource"`
LastGMsgID string `xml:"lastGMsgID"`
IsDebug int `xml:"isDebug"`
ContentType int `xml:"content_type"`
FinderForwardSource string `xml:"finderForwardSource"`
}
FinderFeed 视频号信息
type FinderLive ¶
type FinderLive struct {
FinderLiveID string `xml:"finderLiveID"`
FinderUsername string `xml:"finderUsername"`
FinderObjectID string `xml:"finderObjectID"`
FinderNonceID string `xml:"finderNonceID"`
Nickname string `xml:"nickname"`
HeadURL string `xml:"headUrl"`
Desc string `xml:"desc"`
LiveStatus int `xml:"liveStatus"`
LiveSourceTypeStr string `xml:"liveSourceTypeStr"`
ExtFlag int `xml:"extFlag"`
LiveSecondaryDeviceFlagStr string `xml:"liveSecondaryDeviceFlagStr"`
LiveFlag int `xml:"liveFlag"`
AuthIconURL string `xml:"authIconUrl"`
AuthIconTypeStr string `xml:"authIconTypeStr"`
BindType int `xml:"bindType"`
BizUsername string `xml:"bizUsername"`
BizNickname string `xml:"bizNickname"`
ChargeFlag int `xml:"chargeFlag"`
ReplayStatus int `xml:"replayStatus"`
SpamLiveExtFlagString string `xml:"spamLiveExtFlagString"`
EnterSessionID string `xml:"enterSessionId"`
LiveMode int `xml:"liveMode"`
LiveSubMode int `xml:"liveSubMode"`
Media FinderLiveMedia `xml:"media"`
}
type FinderLiveMedia ¶
type FinderLiveMedia struct {
CoverURL FinderLiveMediaCoverURL `xml:"coverUrl"`
Height int `xml:"height"`
Width int `xml:"width"`
}
type FinderLiveMediaCoverURL ¶
type FinderLiveMediaCoverURL struct {
Text string `xml:",cdata"`
}
type FinderMedia ¶
type FinderMedia struct {
ThumbURL string `xml:"thumbUrl"`
FullCoverURL string `xml:"fullCoverUrl"`
VideoPlayDuration string `xml:"videoPlayDuration"`
URL string `xml:"url"`
CoverURL string `xml:"coverUrl"`
Height string `xml:"height"`
MediaType string `xml:"mediaType"`
FullClipInset string `xml:"fullClipInset"`
Width string `xml:"width"`
}
type FinderMediaList ¶
type FinderMediaList struct {
Media []FinderMedia `xml:"media"`
}
type FinderMegaVideo ¶
type Link ¶
type Link struct {
Name string `xml:"name,attr"`
Type string `xml:"type,attr"`
MemberList MemberList `xml:"memberlist"`
Separator string `xml:"separator,omitempty"`
Title string `xml:"title,omitempty"`
}
type MediaV4 ¶
type MemberList ¶
type MemberList struct {
Members []Member `xml:"member"`
}
type Message ¶
type Message struct {
Version string `json:"-"` // 消息版本,内部判断
Seq int64 `json:"seq"` // 消息序号,10位时间戳 + 3位序号
Time time.Time `json:"time"` // 消息创建时间,10位时间戳
Talker string `json:"talker"` // 聊天对象,微信 ID or 群 ID
TalkerName string `json:"talkerName"` // 聊天对象名称
IsChatRoom bool `json:"isChatRoom"` // 是否为群聊消息
Sender string `json:"sender"` // 发送人,微信 ID
SenderName string `json:"senderName"` // 发送人名称
IsSelf bool `json:"isSelf"` // 是否为自己发送的消息
Type int64 `json:"type"` // 消息类型
SubType int64 `json:"subType"` // 消息子类型
Content string `json:"content"` // 消息内容,文字聊天内容
Contents map[string]interface{} `json:"contents,omitempty"` // 消息内容,多媒体消息,采用更灵活的记录方式
}
func (*Message) ParseMediaInfo ¶
func (*Message) PlainTextContent ¶
func (*Message) SetContent ¶
type MessageV4 ¶
type MessageV4 struct {
SortSeq int64 `json:"sort_seq"` // 10-digit timestamp + 3-digit sequence
ServerID int64 `json:"server_id"` // message ID, used to link voice data
LocalType int64 `json:"local_type"` // message type
UserName string `json:"user_name"` // sender, joined from Name2Id table
CreateTime int64 `json:"create_time"` // unix timestamp (seconds)
MessageContent []byte `json:"message_content"` // plain text or zstd-compressed content
PackedInfoData []byte `json:"packed_info_data"` // extra proto-like data (v4 format)
Status int `json:"status"` // 2=sent, 4=received; used to infer IsSelf (FIXME: use UserName instead)
}
CREATE TABLE Msg_md5(talker)( local_id INTEGER PRIMARY KEY AUTOINCREMENT, server_id INTEGER, local_type INTEGER, sort_seq INTEGER, real_sender_id INTEGER, create_time INTEGER, status INTEGER, upload_status INTEGER, download_status INTEGER, server_seq INTEGER, origin_source INTEGER, source TEXT, message_content TEXT, compress_content TEXT, packed_info_data BLOB, WCDB_CT_message_content INTEGER DEFAULT NULL, WCDB_CT_source INTEGER DEFAULT NULL )
type PatInfo ¶
type PatInfo struct {
FromUsername string `xml:"fromusername"`
ChatUsername string `xml:"chatusername"`
PattedUsername string `xml:"pattedusername"`
PatSuffix string `xml:"patsuffix"`
PatSuffixVersion int `xml:"patsuffixversion"`
Template string `xml:"template"`
}
PatInfo 拍一拍 v2
type PatMsg ¶
type PatMsg struct {
ChatUser string `xml:"chatUser"` // 被拍的用户
RecordNum int `xml:"recordNum"` // 记录数量
Records Records `xml:"records"` // 拍一拍记录
}
PatMsg 拍一拍消息结构
type PatRecord ¶
type PatRecord struct {
FromUser string `xml:"fromUser"` // 发起拍一拍的用户
PattedUser string `xml:"pattedUser"` // 被拍的用户
Templete string `xml:"templete"` // 模板文本
CreateTime int64 `xml:"createTime"` // 创建时间
SvrId string `xml:"svrId"` // 服务器ID
ReadStatus int `xml:"readStatus"` // 已读状态
}
PatRecord 单条拍一拍记录
type QRLink ¶
type QRLink struct {
Scene string `xml:"scene"`
Text string `xml:"text"`
MemberList QRMemberList `xml:"memberlist"`
QRCode string `xml:"qrcode"`
}
type QRMemberList ¶
type QRMemberList struct {
Usernames []UsernameItem `xml:"username"`
}
type RecordInfo ¶
type RecordInfo struct {
XMLName xml.Name `xml:"recordinfo"`
FromScene string `xml:"fromscene,omitempty"`
FavUsername string `xml:"favusername,omitempty"`
FavCreateTime string `xml:"favcreatetime,omitempty"`
IsChatRoom string `xml:"isChatRoom,omitempty"`
Title string `xml:"title,omitempty"`
Desc string `xml:"desc,omitempty"`
Info string `xml:"info,omitempty"`
DataList DataList `xml:"datalist,omitempty"`
}
RecordInfo 表示聊天记录信息
func (*RecordInfo) String ¶
func (r *RecordInfo) String(_type, title, host string) string
type RecordItem ¶
type RecordItem struct {
CDATA string `xml:",cdata"`
// 解析后的记录信息
RecordInfo *RecordInfo
}
type RecordXML ¶
type RecordXML struct {
RecordInfo RecordInfo `xml:"recordinfo,omitempty"`
}
type ReferMsg ¶
type ReferMsg struct {
Type int64 `xml:"type"`
SvrID string `xml:"svrid"`
FromUsr string `xml:"fromusr"`
ChatUsr string `xml:"chatusr"`
DisplayName string `xml:"displayname"`
MsgSource string `xml:"msgsource"`
Content string `xml:"content"`
StrID string `xml:"strid"`
CreateTime int64 `xml:"createtime"`
}
ReferMsg 表示引用消息
type Session ¶
type SessionV4 ¶
type SessionV4 struct {
Username string `json:"username"`
Summary string `json:"summary"`
LastTimestamp int `json:"last_timestamp"`
LastMsgSender string `json:"last_msg_sender"`
LastSenderDisplayName string `json:"last_sender_display_name"`
}
v4 sessions are stored in a standalone database file. CREATE TABLE SessionTable( username TEXT PRIMARY KEY, type INTEGER, unread_count INTEGER, unread_first_msg_srv_id INTEGER, is_hidden INTEGER, summary TEXT, draft TEXT, status INTEGER, last_timestamp INTEGER, sort_timestamp INTEGER, last_clear_unread_timestamp INTEGER, last_msg_locald_id INTEGER, last_msg_type INTEGER, last_msg_sub_type INTEGER, last_msg_sender TEXT, last_sender_display_name TEXT, last_msg_ext_type INTEGER )
type SysMsg ¶
type SysMsg struct {
Type string `xml:"type,attr"`
DelChatRoomMember *DelChatRoomMember `xml:"delchatroommember,omitempty"`
SysMsgTemplate *SysMsgTemplate `xml:"sysmsgtemplate,omitempty"`
RevokeMsg *RevokeMsg `xml:"revokemsg,omitempty"`
}
func (*SysMsg) DelChatRoomMemberString ¶
func (*SysMsg) SysMsgTemplateString ¶
type SysMsgTemplate ¶
type SysMsgTemplate struct {
ContentTemplate ContentTemplate `xml:"content_template"`
}
第二种消息类型:系统消息模板
type UsernameItem ¶
type UsernameItem struct {
Value string `xml:",chardata"`
}
type WCPayInfo ¶
type WCPayInfo struct {
PaySubType int `xml:"paysubtype"` // 支付子类型
FeeDesc string `xml:"feedesc"` // 金额描述,如"¥200000.00"
TranscationID string `xml:"transcationid"` // 交易ID
TransferID string `xml:"transferid"` // 转账ID
InvalidTime string `xml:"invalidtime"` // 失效时间
BeginTransferTime string `xml:"begintransfertime"` // 开始转账时间
EffectiveDate string `xml:"effectivedate"` // 生效日期
PayMemo string `xml:"pay_memo"` // 支付备注
ReceiverUsername string `xml:"receiver_username"` // 接收方用户名
PayerUsername string `xml:"payer_username"` // 支付方用户名
}
WCPayInfo 微信支付信息