Documentation ¶
Index ¶
- Constants
- Variables
- func AdminPermission(ctx *Ctx) bool
- func HasMemePicture(ctx *Ctx) bool
- func MustMemePicture(ctx *Ctx) bool
- func OnlyAtMe(ctx *Ctx) bool
- func OnlyGroup(ctx *Ctx) bool
- func OnlyPrivate(ctx *Ctx) bool
- func Run(c *Config, f IFramework)
- func UserOrGroupAdmin(ctx *Ctx) bool
- type Bot
- type Config
- type Ctx
- func (ctx *Ctx) AgreeFriendVerify(v3, v4, scene string) error
- func (ctx *Ctx) CheckGroupSession() Rule
- func (ctx *Ctx) CheckUserSession() Rule
- func (ctx *Ctx) EventChannel(rule ...Rule) *EventChannel
- func (ctx *Ctx) FuzzyGetByRemarkOrNick(remarkOrNick string) []*User
- func (ctx *Ctx) GetFriends(isRefresh ...bool) (Friends, error)
- func (ctx *Ctx) GetGroupMembers(groupWxId string, isRefresh ...bool) (GroupMembers, error)
- func (ctx *Ctx) GetGroups(isRefresh ...bool) (Groups, error)
- func (ctx *Ctx) GetHistoryByWxId(wxId string) ([]MessageRecord, error)
- func (ctx *Ctx) GetHistoryByWxIdAndDate(wxId, date string) ([]MessageRecord, error)
- func (ctx *Ctx) GetMPs(isRefresh ...bool) (MPs, error)
- func (ctx *Ctx) GetMatcher() *Matcher
- func (ctx *Ctx) GetMemePictures() (string, bool)
- func (ctx *Ctx) GetObjectInfo(wxId string) (*User, error)
- func (ctx *Ctx) GetRobotInfo() (*User, error)
- func (ctx *Ctx) InviteIntoGroup(groupWxId, wxId string, typ int) error
- func (ctx *Ctx) IsApp() bool
- func (ctx *Ctx) IsAt() bool
- func (ctx *Ctx) IsAuthentication() bool
- func (ctx *Ctx) IsEventFriendVerify() bool
- func (ctx *Ctx) IsEventGroupChat() bool
- func (ctx *Ctx) IsEventPrivateChat() bool
- func (ctx *Ctx) IsEventSelfMessage() bool
- func (ctx *Ctx) IsEventSubscription() bool
- func (ctx *Ctx) IsImage() bool
- func (ctx *Ctx) IsLocation() bool
- func (ctx *Ctx) IsMemePictures() bool
- func (ctx *Ctx) IsMicroVideo() bool
- func (ctx *Ctx) IsPossibleFriend() bool
- func (ctx *Ctx) IsRecalled() bool
- func (ctx *Ctx) IsReference() bool
- func (ctx *Ctx) IsShareCard() bool
- func (ctx *Ctx) IsSystem() bool
- func (ctx *Ctx) IsText() bool
- func (ctx *Ctx) IsVideo() bool
- func (ctx *Ctx) IsVoice() bool
- func (ctx *Ctx) MessageString() string
- func (ctx *Ctx) ReplyBusinessCard(targetWxId string) error
- func (ctx *Ctx) ReplyEmoji(path string) error
- func (ctx *Ctx) ReplyFavorites(favoritesId string) error
- func (ctx *Ctx) ReplyFile(path string) error
- func (ctx *Ctx) ReplyImage(path string) error
- func (ctx *Ctx) ReplyMessageRecord(title string, dataList []map[string]interface{}) error
- func (ctx *Ctx) ReplyMessageRecordXML(xmlStr string) error
- func (ctx *Ctx) ReplyMiniProgram(ghId, title, content, imagePath, jumpPath string) error
- func (ctx *Ctx) ReplyMusic(name, author, app, jumpUrl, musicUrl, coverUrl string) error
- func (ctx *Ctx) ReplyShareLink(title, desc, imageUrl, jumpUrl string) error
- func (ctx *Ctx) ReplyText(text string) error
- func (ctx *Ctx) ReplyTextAndAt(text string) error
- func (ctx *Ctx) ReplyVideo(path string) error
- func (ctx *Ctx) ReplyXML(xmlStr string) error
- func (ctx *Ctx) SendBusinessCard(toWxId, targetWxId string) error
- func (ctx *Ctx) SendEmoji(wxId, path string) error
- func (ctx *Ctx) SendFavorites(toWxId, favoritesId string) error
- func (ctx *Ctx) SendFile(wxId, path string) error
- func (ctx *Ctx) SendImage(wxId, path string) error
- func (ctx *Ctx) SendMessageRecord(toWxId, title string, dataList []map[string]interface{}) error
- func (ctx *Ctx) SendMessageRecordXML(toWxId, xmlStr string) error
- func (ctx *Ctx) SendMiniProgram(toWxId, ghId, title, content, imagePath, jumpPath string) error
- func (ctx *Ctx) SendMusic(toWxId, name, author, app, jumpUrl, musicUrl, coverUrl string) error
- func (ctx *Ctx) SendShareLink(wxId, title, desc, imageUrl, jumpUrl string) error
- func (ctx *Ctx) SendText(wxId, text string) error
- func (ctx *Ctx) SendTextAndAt(groupWxId, wxId, text string) error
- func (ctx *Ctx) SendVideo(wxId, path string) error
- func (ctx *Ctx) SendXML(toWxId, xmlStr string) error
- type Engine
- func (e *Engine) On(rules ...Rule) *Matcher
- func (e *Engine) OnCommand(commands string, rules ...Rule) *Matcher
- func (e *Engine) OnCommandGroup(commands []string, rules ...Rule) *Matcher
- func (e *Engine) OnFullMatch(src string, rules ...Rule) *Matcher
- func (e *Engine) OnFullMatchGroup(src []string, rules ...Rule) *Matcher
- func (e *Engine) OnKeyword(keyword string, rules ...Rule) *Matcher
- func (e *Engine) OnKeywordGroup(keywords []string, rules ...Rule) *Matcher
- func (e *Engine) OnMessage(rules ...Rule) *Matcher
- func (e *Engine) OnPrefix(prefix string, rules ...Rule) *Matcher
- func (e *Engine) OnPrefixGroup(prefix []string, rules ...Rule) *Matcher
- func (e *Engine) OnRegex(regexPattern string, rules ...Rule) *Matcher
- func (e *Engine) OnSuffix(suffix string, rules ...Rule) *Matcher
- func (e *Engine) OnSuffixGroup(suffix []string, rules ...Rule) *Matcher
- func (e *Engine) SetBlock(block bool) *Engine
- func (e *Engine) UseMidHandler(rules ...Rule)
- func (e *Engine) UsePostHandler(handler ...Handler)
- func (e *Engine) UsePreHandler(rules ...Rule)
- type Event
- type EventBuffer
- type EventBufferItem
- type EventChannel
- type Friend
- func (f *Friend) AsUser() *User
- func (f *Friend) SendBusinessCard(targetWxId string) error
- func (f *Friend) SendEmoji(path string) error
- func (f *Friend) SendFavorites(favoritesId string) error
- func (f *Friend) SendFile(path string) error
- func (f *Friend) SendImage(path string) error
- func (f *Friend) SendMessageRecord(title string, dataList []map[string]interface{}) error
- func (f *Friend) SendMessageRecordXML(xmlStr string) error
- func (f *Friend) SendMiniProgram(ghId, title, content, imagePath, jumpPath string) error
- func (f *Friend) SendMusic(name, author, app, jumpUrl, musicUrl, coverUrl string) error
- func (f *Friend) SendShareLink(title, desc, imageUrl, jumpUrl string) error
- func (f *Friend) SendText(content string) error
- func (f *Friend) SendVideo(path string) error
- func (f *Friend) SendXML(xmlStr string) error
- type FriendVerify
- type Friends
- func (f Friends) AsUsers() []*User
- func (f Friends) Count() int
- func (f Friends) FuzzyGetByRemarkOrNick(remarkOrNick string) Friends
- func (f Friends) GetByNick(nick string) *Friend
- func (f Friends) GetByNicks(nicks []string) Friends
- func (f Friends) GetByRemark(remark string) *Friend
- func (f Friends) GetByRemarkOrNick(remarkOrNick string) *Friend
- func (f Friends) GetByRemarkOrNicks(remarkOrNicks []string) Friends
- func (f Friends) GetByRemarks(remarks []string) Friends
- func (f Friends) GetByWxId(wxId string) *Friend
- func (f Friends) GetByWxIds(wxIds []string) Friends
- func (f Friends) GetByWxNum(wxNum string) *Friend
- func (f Friends) GetByWxNums(wxNums []string) Friends
- func (f Friends) SendBusinessCard(targetWxId string, delays ...time.Duration) error
- func (f Friends) SendEmoji(path string, delays ...time.Duration) error
- func (f Friends) SendFavorites(favoritesId string, delays ...time.Duration) error
- func (f Friends) SendFile(path string, delays ...time.Duration) error
- func (f Friends) SendImage(path string, delays ...time.Duration) error
- func (f Friends) SendMessageRecord(title string, dataList []map[string]interface{}, delays ...time.Duration) error
- func (f Friends) SendMessageRecordXML(xmlStr string, delays ...time.Duration) error
- func (f Friends) SendMiniProgram(ghId, title, content, imagePath, jumpPath string, delays ...time.Duration) error
- func (f Friends) SendMusic(name, author, app, jumpUrl, musicUrl, coverUrl string, delays ...time.Duration) error
- func (f Friends) SendShareLink(title, desc, imageUrl, jumpUrl string, delays ...time.Duration) error
- func (f Friends) SendText(content string, delays ...time.Duration) error
- func (f Friends) SendVideo(path string, delays ...time.Duration) error
- func (f Friends) SendXML(xmlStr string, delays ...time.Duration) error
- type Group
- func (g *Group) AsUser() *User
- func (g *Group) SendBusinessCard(targetWxId string) error
- func (g *Group) SendEmoji(path string) error
- func (g *Group) SendFavorites(favoritesId string) error
- func (g *Group) SendFile(path string) error
- func (g *Group) SendImage(path string) error
- func (g *Group) SendMessageRecord(title string, dataList []map[string]interface{}) error
- func (g *Group) SendMessageRecordXML(xmlStr string) error
- func (g *Group) SendMiniProgram(ghId, title, content, imagePath, jumpPath string) error
- func (g *Group) SendMusic(name, author, app, jumpUrl, musicUrl, coverUrl string) error
- func (g *Group) SendShareLink(title, desc, imageUrl, jumpUrl string) error
- func (g *Group) SendText(content string) error
- func (g *Group) SendVideo(path string) error
- func (g *Group) SendXML(xmlStr string) error
- type GroupMemberDecrease
- type GroupMemberIncrease
- type GroupMembers
- type Groups
- func (g Groups) AsUsers() []*User
- func (g Groups) Count() int
- func (g Groups) FuzzyGetByRemarkOrNick(remarkOrNick string) Groups
- func (g Groups) GetByNick(nick string) *Group
- func (g Groups) GetByNicks(nicks []string) Groups
- func (g Groups) GetByRemark(remark string) *Group
- func (g Groups) GetByRemarkOrNick(remarkOrNick string) *Group
- func (g Groups) GetByRemarkOrNicks(remarkOrNicks []string) Groups
- func (g Groups) GetByRemarks(remarks []string) Groups
- func (g Groups) GetByWxId(wxId string) *Group
- func (g Groups) GetByWxIds(wxIds []string) Groups
- func (g Groups) GetByWxNum(wxNum string) *Group
- func (g Groups) GetByWxNums(wxNums []string) Groups
- func (g Groups) SendBusinessCard(targetWxId string, delays ...time.Duration) error
- func (g Groups) SendEmoji(path string, delays ...time.Duration) error
- func (g Groups) SendFavorites(favoritesId string, delays ...time.Duration) error
- func (g Groups) SendFile(path string, delays ...time.Duration) error
- func (g Groups) SendImage(path string, delays ...time.Duration) error
- func (g Groups) SendMessageRecord(title string, dataList []map[string]interface{}, delays ...time.Duration) error
- func (g Groups) SendMessageRecordXML(xmlStr string, delays ...time.Duration) error
- func (g Groups) SendMiniProgram(ghId, title, content, imagePath, jumpPath string, delays ...time.Duration) error
- func (g Groups) SendMusic(name, author, app, jumpUrl, musicUrl, coverUrl string, delays ...time.Duration) error
- func (g Groups) SendShareLink(title, desc, imageUrl, jumpUrl string, delays ...time.Duration) error
- func (g Groups) SendText(content string, delays ...time.Duration) error
- func (g Groups) SendVideo(path string, delays ...time.Duration) error
- func (g Groups) SendXML(xmlStr string, delays ...time.Duration) error
- type Handler
- type IFramework
- type MP
- func (m *MP) AsUser() *User
- func (m *MP) SendBusinessCard(targetWxId string) error
- func (m *MP) SendEmoji(path string) error
- func (m *MP) SendFavorites(favoritesId string) error
- func (m *MP) SendFile(path string) error
- func (m *MP) SendImage(path string) error
- func (m *MP) SendMessageRecord(title string, dataList []map[string]interface{}) error
- func (m *MP) SendMessageRecordXML(xmlStr string) error
- func (m *MP) SendMiniProgram(ghId, title, content, imagePath, jumpPath string) error
- func (m *MP) SendMusic(name, author, app, jumpUrl, musicUrl, coverUrl string) error
- func (m *MP) SendShareLink(title, desc, imageUrl, jumpUrl string) error
- func (m *MP) SendText(content string) error
- func (m *MP) SendVideo(path string) error
- func (m *MP) SendXML(xmlStr string) error
- type MPs
- func (m MPs) AsUsers() []*User
- func (m MPs) Count() int
- func (m MPs) FuzzyGetByRemarkOrNick(remarkOrNick string) MPs
- func (m MPs) GetByNick(nick string) *MP
- func (m MPs) GetByNicks(nicks []string) MPs
- func (m MPs) GetByRemark(remark string) *MP
- func (m MPs) GetByRemarkOrNick(remarkOrNick string) *MP
- func (m MPs) GetByRemarkOrNicks(remarkOrNicks []string) MPs
- func (m MPs) GetByRemarks(remarks []string) MPs
- func (m MPs) GetByWxId(wxId string) *MP
- func (m MPs) GetByWxIds(wxIds []string) MPs
- func (m MPs) GetByWxNum(wxNum string) *MP
- func (m MPs) GetByWxNums(wxNums []string) MPs
- func (m MPs) SendBusinessCard(targetWxId string, delays ...time.Duration) error
- func (m MPs) SendEmoji(path string, delays ...time.Duration) error
- func (m MPs) SendFavorites(favoritesId string, delays ...time.Duration) error
- func (m MPs) SendFile(path string, delays ...time.Duration) error
- func (m MPs) SendImage(path string, delays ...time.Duration) error
- func (m MPs) SendMessageRecord(title string, dataList []map[string]interface{}, delays ...time.Duration) error
- func (m MPs) SendMessageRecordXML(xmlStr string, delays ...time.Duration) error
- func (m MPs) SendMiniProgram(ghId, title, content, imagePath, jumpPath string, delays ...time.Duration) error
- func (m MPs) SendMusic(name, author, app, jumpUrl, musicUrl, coverUrl string, delays ...time.Duration) error
- func (m MPs) SendShareLink(title, desc, imageUrl, jumpUrl string, delays ...time.Duration) error
- func (m MPs) SendText(content string, delays ...time.Duration) error
- func (m MPs) SendVideo(path string, delays ...time.Duration) error
- func (m MPs) SendXML(xmlStr string, delays ...time.Duration) error
- type Matcher
- func On(rules ...Rule) *Matcher
- func OnCommand(commands string, rules ...Rule) *Matcher
- func OnCommandGroup(commands []string, rules ...Rule) *Matcher
- func OnFullMatch(src string, rules ...Rule) *Matcher
- func OnFullMatchGroup(src []string, rules ...Rule) *Matcher
- func OnKeyword(keyword string, rules ...Rule) *Matcher
- func OnKeywordGroup(keywords []string, rules ...Rule) *Matcher
- func OnMessage(rules ...Rule) *Matcher
- func OnPrefix(prefix string, rules ...Rule) *Matcher
- func OnPrefixGroup(prefix []string, rules ...Rule) *Matcher
- func OnRegex(regexPattern string, rules ...Rule) *Matcher
- func OnSuffix(suffix string, rules ...Rule) *Matcher
- func OnSuffixGroup(suffix []string, rules ...Rule) *Matcher
- func StoreMatcher(m *Matcher) *Matcher
- func StoreTempMatcher(m *Matcher) *Matcher
- func (m *Matcher) Delete()
- func (m *Matcher) EventChannel(rule ...Rule) *EventChannel
- func (m *Matcher) FirstPriority() *Matcher
- func (m *Matcher) Handle(handler Handler) *Matcher
- func (m *Matcher) SetBlock(block bool) *Matcher
- func (m *Matcher) SetNoTimeout(noTimeout bool) *Matcher
- func (m *Matcher) SetPriority(priority uint64) *Matcher
- type Message
- type MessageRecord
- type Rule
- type Self
- func (s *Self) CheckUserObjNil() bool
- func (s *Self) Friends(update ...bool) (Friends, error)
- func (s *Self) GroupMembers(groupWxId string, update ...bool) (GroupMembers, error)
- func (s *Self) Groups(update ...bool) (Groups, error)
- func (s *Self) Init() error
- func (s *Self) MPs(update ...bool) (MPs, error)
- func (s *Self) Self() (*User, error)
- type State
- type Transfer
- type User
- func (u *User) AsFriend() (*Friend, bool)
- func (u *User) AsGroup() (*Group, bool)
- func (u *User) AsMP() (*MP, bool)
- func (u *User) IsFriend() bool
- func (u *User) IsGroup() bool
- func (u *User) IsMP() bool
- func (u *User) MustAsFriend() *Friend
- func (u *User) MustAsGroup() *Group
- func (u *User) MustAsMP() *MP
- type Withdraw
Constants ¶
const ( EventGroupChat = "EventGroupChat" // 群聊消息事件 EventPrivateChat = "EventPrivateChat" // 私聊消息事件 EventMPChat = "EventMPChat" // 公众号消息事件 EventSelfMessage = "EventSelfMessage" // 自己发的消息事件 EventFriendVerify = "EventFriendVerify" // 好友请求事件 EventTransfer = "EventTransfer" // 好友转账事件 EventMessageWithdraw = "EventMessageWithdraw" // 消息撤回事件 EventSystem = "EventSystem" // 系统消息事件 EventGroupMemberIncrease = "EventGroupMemberIncrease" // 群成员增加事件 EventGroupMemberDecrease = "EventGroupMemberDecrease" // 群成员减少事件 EventInvitedInGroup = "EventInvitedInGroup" // 被邀请入群事件 )
const ( MsgTypeText = 1 // 文本消息 MsgTypeImage = 3 // 图片消息 MsgTypeVoice = 34 // 语音消息 MsgTypeAuthentication = 37 // 认证消息 MsgTypePossibleFriend = 40 // 好友推荐消息 MsgTypeVideo = 43 // 视频消息 MsgTypeMemePicture = 47 // 表情消息 MsgTypeLocation = 48 // 地理位置消息 MsgTypeApp = 49 // APP消息 MsgTypeMicroVideo = 62 // 小视频消息 MsgTypeSystem = 10000 // 系统消息 MsgTypeRecalled = 10002 // 消息撤回 MsgTypeReference = 10003 // 消息引用 )
Variables ¶
var EmojiSymbol = []string{}/* 134 elements not displayed */
EmojiSymbol 表情符号
Functions ¶
func MustMemePicture ¶
MustMemePicture 消息不存在表情包图片阻塞至有图片,默认30s,超时返回false 阻塞时长可通过ctx.State["timeout"]设置
Types ¶
type Bot ¶ added in v1.2.0
type Bot struct {
// contains filtered or unexported fields
}
func (*Bot) GetCommandPrefix ¶ added in v1.2.0
GetCommandPrefix 获取命令前缀
func (*Bot) GetSuperUsers ¶ added in v1.2.0
GetSuperUsers 获取超级用户
type Config ¶
type Config struct { BotWxId string `mapstructure:"botWxId"` // 机器人微信ID BotNickname string `mapstructure:"botNickname"` // 机器人名称 SuperUsers []string `mapstructure:"superUsers"` // 超级用户(管理员) CommandPrefix string `mapstructure:"commandPrefix"` // 管理员触发命令 ServerPort uint `mapstructure:"serverPort"` // 启动HTTP服务端口 BufferLen uint `mapstructure:"-"` // 事件缓冲区长度, 默认4096 Latency time.Duration `mapstructure:"-"` // 事件处理延迟 (延迟 latency + (0~100ms) 再处理事件) (默认1s) MaxProcessTime time.Duration `mapstructure:"-"` // 事件最大处理时间 (默认3min) Framework struct { Name string `mapstructure:"name"` // 接入框架名称 ApiUrl string `mapstructure:"apiUrl"` // 接入框架API地址 ApiToken string `mapstructure:"apiToken"` // 接入框架API Token } `mapstructure:"framework"` }
type Ctx ¶
func (*Ctx) AgreeFriendVerify ¶
AgreeFriendVerify 同意好友验证
func (*Ctx) CheckGroupSession ¶
CheckGroupSession 判断会话连续性,必须同一个群,可以不同用户
func (*Ctx) CheckUserSession ¶
CheckUserSession 判断会话连续性,必须同一个群同一个用户
func (*Ctx) EventChannel ¶
func (ctx *Ctx) EventChannel(rule ...Rule) *EventChannel
EventChannel 用当前事件创建一个新的事件通道
func (*Ctx) FuzzyGetByRemarkOrNick ¶ added in v1.2.9
FuzzyGetByRemarkOrNick 模糊查询好友、群组、公众号
func (*Ctx) GetFriends ¶ added in v1.2.7
GetFriends 获取好友列表
func (*Ctx) GetGroupMembers ¶ added in v1.2.7
func (ctx *Ctx) GetGroupMembers(groupWxId string, isRefresh ...bool) (GroupMembers, error)
GetGroupMembers 获取群组成员列表
func (*Ctx) GetHistoryByWxId ¶ added in v1.2.1
func (ctx *Ctx) GetHistoryByWxId(wxId string) ([]MessageRecord, error)
GetHistoryByWxId 根据wxId获取消息记录
func (*Ctx) GetHistoryByWxIdAndDate ¶ added in v1.2.2
func (ctx *Ctx) GetHistoryByWxIdAndDate(wxId, date string) ([]MessageRecord, error)
GetHistoryByWxIdAndDate 根据wxId和日期获取消息记录
func (*Ctx) GetMemePictures ¶ added in v1.2.1
GetMemePictures 获取表情包图片地址
func (*Ctx) GetObjectInfo ¶ added in v1.2.9
GetObjectInfo 获取对象信息,wxId: 好友ID/群ID/公众号ID
func (*Ctx) GetRobotInfo ¶ added in v1.2.9
GetRobotInfo 获取机器人信息
func (*Ctx) InviteIntoGroup ¶
InviteIntoGroup 邀请好友加入群组; typ:1-直接拉,2-发送邀请链接
func (*Ctx) IsAuthentication ¶
IsAuthentication 判断消息类型是否是认证消息
func (*Ctx) IsEventFriendVerify ¶
IsEventFriendVerify 判断消息是否是好友请求消息
func (*Ctx) IsEventPrivateChat ¶
IsEventPrivateChat 判断消息是否是私聊消息
func (*Ctx) IsEventSelfMessage ¶ added in v1.0.10
IsEventSelfMessage 判断消息是否是机器人自己发出的消息
func (*Ctx) IsEventSubscription ¶ added in v1.1.2
IsEventSubscription 判断消息是否是订阅消息
func (*Ctx) IsPossibleFriend ¶
IsPossibleFriend 判断消息类型是否是好友推荐消息
func (*Ctx) ReplyBusinessCard ¶
ReplyBusinessCard 回复名片消息
func (*Ctx) ReplyFavorites ¶
ReplyFavorites 回复收藏消息
func (*Ctx) ReplyMessageRecord ¶
ReplyMessageRecord 回复消息记录
func (*Ctx) ReplyMessageRecordXML ¶
ReplyMessageRecordXML 回复消息记录(XML方式)
func (*Ctx) ReplyMiniProgram ¶
ReplyMiniProgram 回复小程序消息
func (*Ctx) ReplyMusic ¶
ReplyMusic 回复音乐消息
func (*Ctx) ReplyShareLink ¶
ReplyShareLink 回复分享链接消息
func (*Ctx) ReplyTextAndAt ¶
ReplyTextAndAt 回复文本消息并@某人,如果在私聊中则不会@某人
func (*Ctx) SendBusinessCard ¶
SendBusinessCard 发送名片消息到指定好友
func (*Ctx) SendFavorites ¶
SendFavorites 发送收藏消息到指定好友
func (*Ctx) SendMessageRecord ¶
SendMessageRecord 发送消息记录到指定好友
func (*Ctx) SendMessageRecordXML ¶
SendMessageRecordXML 发送消息记录(XML方式)到指定好友
func (*Ctx) SendMiniProgram ¶
SendMiniProgram 发送小程序消息到指定好友
func (*Ctx) SendShareLink ¶
SendShareLink 发送分享链接消息到指定好友
func (*Ctx) SendTextAndAt ¶
SendTextAndAt 发送文本消息并@某人到指定群指定用户,仅限群聊
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func (*Engine) OnCommandGroup ¶
OnCommandGroup 命令触发器组
func (*Engine) OnFullMatch ¶
OnFullMatch 完全匹配触发器
func (*Engine) OnFullMatchGroup ¶
OnFullMatchGroup 完全匹配触发器组
func (*Engine) OnKeywordGroup ¶
OnKeywordGroup 关键词触发器组
func (*Engine) OnPrefixGroup ¶
OnPrefixGroup 前缀触发器组
func (*Engine) OnSuffixGroup ¶
OnSuffixGroup 后缀触发器组
func (*Engine) UseMidHandler ¶
UseMidHandler 添加中间处理器,会在 Rule 判断后, Matcher 触发前触发,如果 midHandler 没有通过,则 Matcher 不会触发 可用于速率限制等
func (*Engine) UsePostHandler ¶
UsePostHandler 添加后置处理器,会在 Matcher 触发后触发,如果 postHandler 返回 false,则后续的 post handler 不会触发 可用于反并发等
func (*Engine) UsePreHandler ¶
UsePreHandler 添加前置处理器,会在 Rule 判断前触发,如果 preHandler 没有通过,则 Rule, Matcher 不会触发 可用于分群组管理插件等
type Event ¶
type Event struct { Type string // 消息类型 RobotWxId string // 机器人微信id IsAtMe bool // 机器人是否被@了,@所有人不算 FromUniqueID string // 消息来源唯一id, 私聊为发送者微信id, 群聊为群id FromUniqueName string // 消息来源唯一名称, 私聊为发送者昵称, 群聊为群名称 FromWxId string // 消息来源微信id FromName string // 消息来源昵称 FromGroup string // 消息来源群id FromGroupName string // 消息来源群名称 RawMessage string // 原始消息 Message *Message // 消息内容 SubscriptionMessage *Message // 订阅号消息 FriendVerify *FriendVerify // 好友验证消息 Transfer *Transfer // 转账消息 Withdraw *Withdraw // 撤回消息 GroupMemberIncrease *GroupMemberIncrease // 群成员增加消息 GroupMemberDecrease *GroupMemberDecrease // 群成员减少消息 }
Event 记录一次回调事件
type EventBuffer ¶
func NewEventBuffer ¶
func NewEventBuffer(bufferLen uint) *EventBuffer
func (*EventBuffer) Loop ¶
func (e *EventBuffer) Loop(latency, maxWait time.Duration, process func(*Event, IFramework, time.Duration))
Loop 以给定的延迟和最长等待时间处理环中的事件
func (*EventBuffer) ProcessEvent ¶
func (e *EventBuffer) ProcessEvent(event *Event, framework IFramework)
ProcessEvent 处理事件
type EventBufferItem ¶
type EventBufferItem struct {
// contains filtered or unexported fields
}
type EventChannel ¶
EventChannel 用于异步获取指定事件
func NewEventChannel ¶
func NewEventChannel(Priority uint64, Block bool, rule ...Rule) *EventChannel
NewEventChannel 创建一个新的 EventChannel用于异步获取指定事件
func (*EventChannel) Next ¶
func (n *EventChannel) Next() <-chan *Ctx
Next 返回一个 chan 用于接收下一个指定事件 该 chan 必须接收,如需手动取消监听,请使用 Repeat 方法
func (*EventChannel) Repeat ¶
func (n *EventChannel) Repeat() (recv <-chan *Ctx, cancel func())
Repeat 返回一个 chan 用于接收无穷个指定事件,和一个取消监听的函数 如果没有取消监听,将不断监听指定事件
type Friend ¶ added in v1.2.0
type Friend struct{ *User }
Friend 好友对象
func (*Friend) SendBusinessCard ¶ added in v1.2.0
SendBusinessCard 发送名片消息
func (*Friend) SendFavorites ¶ added in v1.2.0
SendFavorites 发送收藏消息
func (*Friend) SendMessageRecord ¶ added in v1.2.0
SendMessageRecord 发送消息记录
func (*Friend) SendMessageRecordXML ¶ added in v1.2.0
SendMessageRecordXML 发送消息记录(支持xml)
func (*Friend) SendMiniProgram ¶ added in v1.2.0
SendMiniProgram 发送小程序消息
func (*Friend) SendShareLink ¶ added in v1.2.0
SendShareLink 发送分享链接消息
type FriendVerify ¶
type FriendVerify struct { WxId string // 发送者微信id Nick string // 发送者昵称 V1 string // 验证V1 V2 string // 验证V2 V3 string // 验证V3 V4 string // 验证V4 AvatarUrl string // 头像url Content string // 验证内容 Scene string // 验证场景 }
FriendVerify 记录好友验证消息的具体内容
type Friends ¶ added in v1.2.0
type Friends []*Friend
Friends 好友列表
func (Friends) FuzzyGetByRemarkOrNick ¶ added in v1.2.9
FuzzyGetByRemarkOrNick 根据备注或昵称模糊匹配好友列表
func (Friends) GetByNicks ¶ added in v1.2.8
GetByNicks 根据昵称列表获取好友列表
func (Friends) GetByRemark ¶ added in v1.2.8
GetByRemark 根据备注获取好友
func (Friends) GetByRemarkOrNick ¶ added in v1.2.8
GetByRemarkOrNick 根据备注或昵称获取好友
func (Friends) GetByRemarkOrNicks ¶ added in v1.2.8
GetByRemarkOrNicks 根据备注或昵称列表获取好友列表
func (Friends) GetByRemarks ¶ added in v1.2.8
GetByRemarks 根据备注列表获取好友列表
func (Friends) GetByWxIds ¶ added in v1.2.8
GetByWxIds 根据微信ID列表获取好友列表
func (Friends) GetByWxNum ¶ added in v1.2.8
GetByWxNum 根据微信号获取好友
func (Friends) GetByWxNums ¶ added in v1.2.8
GetByWxNums 根据微信号列表获取好友列表
func (Friends) SendBusinessCard ¶ added in v1.2.7
SendBusinessCard 依次发送名片消息, delays为每个好友发送消息的间隔时间, 默认为1秒, 为0时不间隔
func (Friends) SendFavorites ¶ added in v1.2.7
SendFavorites 依次发送收藏消息, delays为每个好友发送消息的间隔时间, 默认为1秒, 为0时不间隔
func (Friends) SendMessageRecord ¶ added in v1.2.7
func (f Friends) SendMessageRecord(title string, dataList []map[string]interface{}, delays ...time.Duration) error
SendMessageRecord 依次发送消息记录, delays为每个好友发送消息的间隔时间, 默认为1秒, 为0时不间隔
func (Friends) SendMessageRecordXML ¶ added in v1.2.7
SendMessageRecordXML 依次发送消息记录, delays为每个好友发送消息的间隔时间, 默认为1秒, 为0时不间隔
func (Friends) SendMiniProgram ¶ added in v1.2.7
func (f Friends) SendMiniProgram(ghId, title, content, imagePath, jumpPath string, delays ...time.Duration) error
SendMiniProgram 依次发送小程序消息, delays为每个好友发送消息的间隔时间, 默认为1秒, 为0时不间隔
func (Friends) SendMusic ¶ added in v1.2.7
func (f Friends) SendMusic(name, author, app, jumpUrl, musicUrl, coverUrl string, delays ...time.Duration) error
SendMusic 依次发送音乐消息, delays为每个好友发送消息的间隔时间, 默认为1秒, 为0时不间隔
func (Friends) SendShareLink ¶ added in v1.2.7
func (f Friends) SendShareLink(title, desc, imageUrl, jumpUrl string, delays ...time.Duration) error
SendShareLink 依次发送分享链接消息, delays为每个好友发送消息的间隔时间, 默认为1秒, 为0时不间隔
type Group ¶ added in v1.2.0
type Group struct{ *User }
Group 群组对象
func (*Group) SendBusinessCard ¶ added in v1.2.7
SendBusinessCard 发送名片消息
func (*Group) SendFavorites ¶ added in v1.2.7
SendFavorites 发送收藏消息
func (*Group) SendMessageRecord ¶ added in v1.2.7
SendMessageRecord 发送消息记录
func (*Group) SendMessageRecordXML ¶ added in v1.2.7
SendMessageRecordXML 发送消息记录(支持xml)
func (*Group) SendMiniProgram ¶ added in v1.2.7
SendMiniProgram 发送小程序消息
func (*Group) SendShareLink ¶ added in v1.2.7
SendShareLink 发送分享链接消息
type GroupMemberDecrease ¶ added in v1.0.10
type GroupMemberDecrease struct { }
GroupMemberDecrease 记录群成员减少消息的具体内容
type GroupMemberIncrease ¶ added in v1.0.10
type GroupMemberIncrease struct { }
GroupMemberIncrease 记录群成员增加消息的具体内容
type Groups ¶ added in v1.2.0
type Groups []*Group
Groups 群组列表
func (Groups) FuzzyGetByRemarkOrNick ¶ added in v1.2.9
FuzzyGetByRemarkOrNick 根据备注或昵称模糊匹配好友列表
func (Groups) GetByNicks ¶ added in v1.2.8
GetByNicks 根据昵称列表获取群组列表
func (Groups) GetByRemark ¶ added in v1.2.8
GetByRemark 根据备注获取群组
func (Groups) GetByRemarkOrNick ¶ added in v1.2.8
GetByRemarkOrNick 根据备注或昵称获取群组
func (Groups) GetByRemarkOrNicks ¶ added in v1.2.8
GetByRemarkOrNicks 根据备注或昵称列表获取群组列表
func (Groups) GetByRemarks ¶ added in v1.2.8
GetByRemarks 根据备注列表获取群组列表
func (Groups) GetByWxIds ¶ added in v1.2.8
GetByWxIds 根据微信ID列表获取群组列表
func (Groups) GetByWxNum ¶ added in v1.2.8
GetByWxNum 根据微信号获取群组
func (Groups) GetByWxNums ¶ added in v1.2.8
GetByWxNums 根据微信号列表获取群组列表
func (Groups) SendBusinessCard ¶ added in v1.2.7
SendBusinessCard 依次发送名片消息, delays为每个好友发送消息的间隔时间, 默认为1秒, 为0时不间隔
func (Groups) SendFavorites ¶ added in v1.2.7
SendFavorites 依次发送收藏夹消息, delays为每个好友发送消息的间隔时间, 默认为1秒, 为0时不间隔
func (Groups) SendMessageRecord ¶ added in v1.2.7
func (g Groups) SendMessageRecord(title string, dataList []map[string]interface{}, delays ...time.Duration) error
SendMessageRecord 依次发送消息记录, delays为每个好友发送消息的间隔时间, 默认为1秒, 为0时不间隔
func (Groups) SendMessageRecordXML ¶ added in v1.2.7
SendMessageRecordXML 依次发送消息记录, delays为每个好友发送消息的间隔时间, 默认为1秒, 为0时不间隔
func (Groups) SendMiniProgram ¶ added in v1.2.7
func (g Groups) SendMiniProgram(ghId, title, content, imagePath, jumpPath string, delays ...time.Duration) error
SendMiniProgram 依次发送小程序消息, delays为每个好友发送消息的间隔时间, 默认为1秒, 为0时不间隔
func (Groups) SendMusic ¶ added in v1.2.7
func (g Groups) SendMusic(name, author, app, jumpUrl, musicUrl, coverUrl string, delays ...time.Duration) error
SendMusic 依次发送音乐消息, delays为每个好友发送消息的间隔时间, 默认为1秒, 为0时不间隔
func (Groups) SendShareLink ¶ added in v1.2.7
SendShareLink 依次发送分享链接消息, delays为每个好友发送消息的间隔时间, 默认为1秒, 为0时不间隔
type IFramework ¶
type IFramework interface { // Callback 这是消息回调方法,vx框架回调消息转发给该Server Callback(func(*Event, IFramework)) // GetRobotInfo 获取机器人信息 // return: User, error GetRobotInfo() (*User, error) // GetMemePictures 获取表情包图片地址(迷因图) // return: 图片链接(网络URL或图片base64) GetMemePictures(message *Message) string // SendText 发送文本消息 // toWxId: 好友ID/群ID // text: 文本内容 SendText(toWxId, text string) error // SendTextAndAt 发送文本消息并@,只有群聊有效 // toGroupWxId: 群ID // toWxId: 好友ID/群ID/all // toWxName: 好友昵称/群昵称,留空为自动获取 // text: 文本内容 SendTextAndAt(toGroupWxId, toWxId, toWxName, text string) error // SendImage 发送图片消息 // toWxId: 好友ID/群ID // path: 图片路径 SendImage(toWxId, path string) error // toWxId: 好友ID/群ID // title: 标题 // desc: 描述 // imageUrl: 图片链接 // jumpUrl: 跳转链接 SendShareLink(toWxId, title, desc, imageUrl, jumpUrl string) error // SendFile 发送文件消息 // toWxId: 好友ID/群ID/公众号ID // path: 本地文件绝对路径 SendFile(toWxId, path string) error // SendVideo 发送视频消息 // toWxId: 好友ID/群ID/公众号ID // path: 本地视频文件绝对路径 SendVideo(toWxId, path string) error // SendEmoji 发送表情消息 // toWxId: 好友ID/群ID/公众号ID // path: 本地动态表情文件绝对路径 SendEmoji(toWxId, path string) error // SendMusic 发送音乐消息 // toWxId: 好友ID/群ID/公众号ID // name: 音乐名称 // author: 音乐作者 // app: 音乐来源(VLW需留空),酷狗/wx79f2c4418704b4f8,网易云/wx8dd6ecd81906fd84,QQ音乐/wx5aa333606550dfd5 // jumpUrl: 音乐跳转链接 // musicUrl: 网络歌曲直链 // coverUrl: 封面图片链接 SendMusic(toWxId, name, author, app, jumpUrl, musicUrl, coverUrl string) error // SendMiniProgram 发送小程序消息 // toWxId: 好友ID/群ID/公众号ID // ghId: 小程序ID // title: 标题 // content: 内容 // imagePath: 图片路径, 本地图片路径或网络图片URL // jumpPath: 小程序点击跳转地址,例如:pages/index/index.html SendMiniProgram(toWxId, ghId, title, content, imagePath, jumpPath string) error // SendMessageRecord 发送消息记录 // toWxId: 好友ID/群ID/公众号ID // title: 仅供电脑上显示用,手机上的话微信会根据[显示昵称]来自动生成 谁和谁的聊天记录 // dataList: // - wxid: 发送此条消息的人的wxid // - nickName: 显示的昵称(可随意伪造) // - timestamp: 10位时间戳 // - msg: 消息内容 SendMessageRecord(toWxId, title string, dataList []map[string]interface{}) error // SendMessageRecordXML 发送消息记录(XML方式) // toWxId: 好友ID/群ID/公众号ID // xmlStr: 消息记录XML代码 SendMessageRecordXML(toWxId, xmlStr string) error // SendFavorites 发送收藏消息 // toWxId: 好友ID/群ID/公众号ID // favoritesId: 收藏夹ID SendFavorites(toWxId, favoritesId string) error // SendXML 发送XML消息 // toWxId: 好友ID/群ID/公众号ID // xmlStr: XML代码 SendXML(toWxId, xmlStr string) error // SendBusinessCard 发送名片消息 // toWxId: 好友ID/群ID/公众号ID // targetWxId: 目标用户ID SendBusinessCard(toWxId, targetWxId string) error // AgreeFriendVerify 同意好友验证 // v3: 验证V3 // v4: 验证V4 // scene: 验证场景 AgreeFriendVerify(v3, v4, scene string) error // InviteIntoGroup 邀请好友加入群组 // groupWxId: 群ID // wxId: 好友ID // typ: 邀请类型,1-直接拉,2-发送邀请链接 InviteIntoGroup(groupWxId, wxId string, typ int) error // GetObjectInfo 获取对象信息 // wxId: 好友ID/群ID/公众号ID // return: User, error GetObjectInfo(wxId string) (*User, error) // GetFriends 获取好友列表 // isRefresh: 是否刷新 false-从缓存中获取,true-重新遍历二叉树并刷新缓存 // return: []*User, error GetFriends(isRefresh bool) ([]*User, error) // GetGroups 获取群组列表 // isRefresh: 是否刷新 false-从缓存中获取,true-重新遍历二叉树并刷新缓存 // return: []*User, error GetGroups(isRefresh bool) ([]*User, error) // GetGroupMembers 获取群成员列表 // groupWxId: 群ID // isRefresh: 是否刷新 false-从缓存中获取,true-重新遍历二叉树并刷新缓存 // return: []*User, error GetGroupMembers(groupWxId string, isRefresh bool) ([]*User, error) // GetMPs 获取公众号订阅列表 // isRefresh: 是否刷新 false-从缓存中获取,true-重新遍历二叉树并刷新缓存 // return: []*User, error GetMPs(isRefresh bool) ([]*User, error) }
IFramework 这是接入框架所定义的接口
type MP ¶ added in v1.2.0
type MP struct{ *User }
MP 公众号对象
func (*MP) SendBusinessCard ¶ added in v1.2.7
SendBusinessCard 发送名片消息
func (*MP) SendFavorites ¶ added in v1.2.7
SendFavorites 发送收藏消息
func (*MP) SendMessageRecord ¶ added in v1.2.7
SendMessageRecord 发送消息记录
func (*MP) SendMessageRecordXML ¶ added in v1.2.7
SendMessageRecordXML 发送消息记录(支持xml)
func (*MP) SendMiniProgram ¶ added in v1.2.7
SendMiniProgram 发送小程序消息
func (*MP) SendShareLink ¶ added in v1.2.7
SendShareLink 发送分享链接消息
type MPs ¶ added in v1.2.0
type MPs []*MP
MPs 公众号列表
func (MPs) FuzzyGetByRemarkOrNick ¶ added in v1.2.9
FuzzyGetByRemarkOrNick 根据备注或昵称模糊匹配好友列表
func (MPs) GetByNicks ¶ added in v1.2.8
GetByNicks 根据昵称列表获取公众号列表
func (MPs) GetByRemark ¶ added in v1.2.8
GetByRemark 根据备注获取公众号
func (MPs) GetByRemarkOrNick ¶ added in v1.2.8
GetByRemarkOrNick 根据备注或昵称获取公众号
func (MPs) GetByRemarkOrNicks ¶ added in v1.2.8
GetByRemarkOrNicks 根据备注或昵称列表获取公众号列表
func (MPs) GetByRemarks ¶ added in v1.2.8
GetByRemarks 根据备注列表获取公众号列表
func (MPs) GetByWxIds ¶ added in v1.2.8
GetByWxIds 根据微信ID列表获取公众号列表
func (MPs) GetByWxNum ¶ added in v1.2.8
GetByWxNum 根据微信号获取公众号
func (MPs) GetByWxNums ¶ added in v1.2.8
GetByWxNums 根据微信号列表获取公众号列表
func (MPs) SendBusinessCard ¶ added in v1.2.7
SendBusinessCard 依次发送名片消息, delays为每个好友发送消息的间隔时间, 默认为1秒, 为0时不间隔
func (MPs) SendFavorites ¶ added in v1.2.7
SendFavorites 依次发送收藏夹消息, delays为每个好友发送消息的间隔时间, 默认为1秒, 为0时不间隔
func (MPs) SendMessageRecord ¶ added in v1.2.7
func (m MPs) SendMessageRecord(title string, dataList []map[string]interface{}, delays ...time.Duration) error
SendMessageRecord 依次发送消息记录, delays为每个好友发送消息的间隔时间, 默认为1秒, 为0时不间隔
func (MPs) SendMessageRecordXML ¶ added in v1.2.7
SendMessageRecordXML 依次发送消息记录, delays为每个好友发送消息的间隔时间, 默认为1秒, 为0时不间隔
func (MPs) SendMiniProgram ¶ added in v1.2.7
func (m MPs) SendMiniProgram(ghId, title, content, imagePath, jumpPath string, delays ...time.Duration) error
SendMiniProgram 依次发送小程序消息, delays为每个好友发送消息的间隔时间, 默认为1秒, 为0时不间隔
func (MPs) SendMusic ¶ added in v1.2.7
func (m MPs) SendMusic(name, author, app, jumpUrl, musicUrl, coverUrl string, delays ...time.Duration) error
SendMusic 依次发送音乐消息, delays为每个好友发送消息的间隔时间, 默认为1秒, 为0时不间隔
func (MPs) SendShareLink ¶ added in v1.2.7
SendShareLink 依次发送分享链接消息, delays为每个好友发送消息的间隔时间, 默认为1秒, 为0时不间隔
type Matcher ¶
type Matcher struct { // Temp 是否为临时Matcher,临时 Matcher 匹配一次后就会删除当前 Matcher Temp bool // Block 是否阻断后续 Matcher,为true时当前Matcher匹配成功后,后续Matcher不参与匹配 Block bool // Break 是否退出后续匹配流程, 只有 Rule 返回false且此值为真才会退出, 且不对 mid handler以下的 Rule 生效 Break bool // NoTimeout 处理是否不设超时 NoTimeout bool // Priority 优先级,越小优先级越高 Priority uint64 // Rules 匹配规则 Rules []Rule // Handler 处理事件的函数 Handler Handler // Engine 注册 Matcher 的 Engine,Engine可为一系列 Matcher 添加通用 Rule 和其他钩子 Engine *Engine }
Matcher 是匹配和处理事件的最小单元
func OnCommandGroup ¶
OnCommandGroup 命令触发器组
func OnFullMatchGroup ¶
OnFullMatchGroup 完全匹配触发器组
func OnKeywordGroup ¶
OnKeywordGroup 关键词触发器组
func OnPrefixGroup ¶
OnPrefixGroup 前缀触发器组
func OnSuffixGroup ¶
OnSuffixGroup 后缀触发器组
func StoreTempMatcher ¶
StoreTempMatcher 向匹配器列表中添加一个临时匹配器,临时匹配器只会触发匹配一次
func (*Matcher) EventChannel ¶
func (m *Matcher) EventChannel(rule ...Rule) *EventChannel
EventChannel 用当前上下文创建一个EventChannel,会阻塞其他事件
func (*Matcher) FirstPriority ¶
FirstPriority 设置当前 Matcher 优先级 - 0
func (*Matcher) SetNoTimeout ¶
SetNoTimeout 设置处理时不设超时
func (*Matcher) SetPriority ¶
SetPriority 设置当前 Matcher 优先级
type MessageRecord ¶ added in v1.2.1
type MessageRecord struct { ID uint `gorm:"primarykey"` // 主键 Type string `gorm:"column:type"` // 消息类型 FromWxId string `gorm:"column:from_wxid"` // 消息来源wxid,群消息为群wxid,私聊消息为发送者wxid FromNick string `gorm:"column:from_nick"` // 消息来源昵称,群消息为群昵称,私聊消息为发送者昵称 SenderWxId string `gorm:"column:sender_wxid"` // 消息具体发送者wxid SenderNick string `gorm:"column:sender_nick"` // 消息具体发送者昵称 Content string `gorm:"column:content"` // 消息内容 CreatedAt time.Time `gorm:"column:created_at"` // 创建时间 }
MessageRecord 消息记录表
type Self ¶ added in v1.2.0
type Self struct { *User // contains filtered or unexported fields }
Self 包装了关于bot、好友、群组、公众号的操作
func (*Self) CheckUserObjNil ¶ added in v1.2.0
CheckUserObjNil 检查好友、群、公众号列表是否为空
func (*Self) GroupMembers ¶ added in v1.2.7
func (s *Self) GroupMembers(groupWxId string, update ...bool) (GroupMembers, error)
GroupMembers 获取所有的群成员
type Transfer ¶ added in v1.0.10
type Transfer struct { FromWxId string // 发送者微信ID MsgSource int64 // 消息来源 1:收到转账 2:对方接收转账 3:发出转账 4:自己接收转账 5:对方退还 6:自己退还 TransferType int64 // 转账类型 1:即时到账 2:延时到账 Money string // 转账金额,单位元 Memo string // 转账备注 TransferId string // 转账ID TransferTime string // 转账时间,10位时间戳 }
Transfer 记录转账消息的具体内容
type User ¶ added in v1.2.0
type User struct { WxId string `json:"wxId"` // 微信ID WxNum string `json:"wxNum"` // 微信号 Nick string `json:"nick"` // 昵称 Remark string `json:"remark"` // 备注 NickBrief string `json:"nickBrief"` // 昵称简拼 NickWhole string `json:"nickWhole"` // 昵称全拼 RemarkBrief string `json:"remarkBrief"` // 备注简拼 RemarkWhole string `json:"remarkWhole"` // 备注全拼 EnBrief string `json:"enBrief"` // 英文简拼 EnWhole string `json:"enWhole"` // 英文全拼 V3 string `json:"v3"` // v3数据,同意好友验证时需要 V4 string `json:"v4"` // v4数据,同意好友验证时需要 Sign string `json:"sign"` // 签名,需要在会话列表中 Country string `json:"country"` // 国家,需要在会话列表中 Province string `json:"province"` // 省份,需要在会话列表中 City string `json:"city"` // 城市,需要在会话列表中 MomentsBackgroundImgUrl string `json:"momentsBackgroundImgUrl"` // 朋友圈背景图,需要在朋友圈中 AvatarMinUrl string `json:"avatarMinUrl"` // 头像小图,需要在会话列表中 AvatarMaxUrl string `json:"avatarMaxUrl"` // 头像大图,需要在会话列表中 Sex string `json:"sex"` // 性别,1男,2女,0未知 MemberNum int `json:"memberNum"` // 群成员数量,仅当对象是群聊时有效 // contains filtered or unexported fields }
User 抽象用户对象,对象可以是好友、群组、公众号
func (*User) MustAsFriend ¶ added in v1.2.7
MustAsFriend 转换为好友对象,Must表示确定当前对象一定是好友对象,如果不是可能会出错
func (*User) MustAsGroup ¶ added in v1.2.7
MustAsGroup 转换为群聊对象,Must表示确定当前对象一定是群聊对象,如果不是可能会出错