gochat

package
v0.0.0-...-38ae1c3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2017 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfirmAuthEventData

type ConfirmAuthEventData struct {
	RedirectUrl string
}

授权事件数据

type Contact

type Contact struct {
	Uin              float64
	UserName         string
	NickName         string
	HeadImgUrl       string
	ContactFlag      float64
	MemberCount      float64
	MemberList       []*Member
	MemberMap        map[string]*Member
	RemarkName       string
	HideInputBarFlag float64
	Sex              float64
	Signature        string
	VerifyFlag       float64
	PYInitial        string
	PYQuanPin        string
	RemarkPYInitial  string
	RemarkPYQuanPin  string
	StarFriend       float64
	AppAccountFlag   float64
	Statues          float64
	AttrStatus       float64
	Province         string
	City             string
	Alias            string
	SnsFlag          float64
	UniFriend        float64
	DisplayName      string
	ChatRoomId       float64
	KeyWord          string
	EncryChatRoomId  string
	IsOwner          float64
	Type             ContactType
}

联系人

type ContactDeleteEventData

type ContactDeleteEventData struct {
	UserNames []string
}

联系人删除事件数据

type ContactModifyEventData

type ContactModifyEventData struct {
	UserNames []string
}

联系人修改事件数据

type ContactType

type ContactType int

联系人类型

const (
	Official ContactType // 公众号
	Friend               // 好友
	Group                // 群组
)

type ContactsInitEventData

type ContactsInitEventData struct {
	ContactsCount int
}

通讯录初始化事件数据

type Event

type Event struct {
	Time      int64
	EventType EventType
	Data      interface{}
}

事件体

type EventType

type EventType int

事件类型

const (
	GEN_UUID_EVENT       EventType // 生成Uuid
	SCAN_CODE_EVENT                // 已扫码,未确认
	CONFIRM_AUTH_EVENT             // 已确认授权登录
	LOGIN_EVENT                    // 已登录
	INIT_EVENT                     // 初始化完成
	CONTACTS_INIT_EVENT            // 联系人初始化完
	LISTEN_FAILED_EVENT            // 同步微信失败,可能为客户端已退出 | 被微信反爬虫
	CONTACT_MODIFY_EVENT           // 联系人改变了
	CONTACT_DELETE_EVENT           // 联系人删除事件
	MESSAGE_EVENT                  // 消息
)

type GenUuidEventData

type GenUuidEventData struct {
	Uuid string
}

生成Uuid事件的数据

type InitEventData

type InitEventData struct {
	Me Contact
}

初始化事件数据

type ListenFailedEventData

type ListenFailedEventData struct {
	ListenFailedCount int
	Host              string
}

同步微信失败事件数据

type LocationInfo

type LocationInfo struct {
	X     string
	Y     string
	Label string
	Img   string
}

位置信息数据

type LoginEventData

type LoginEventData struct {
	DeviceID string
}

登录事件数据

type MediaType

type MediaType int
const (
	MEDIA_PIC MediaType
	MEDIA_VIDEO
	MEDIA_DOC
)

type Member

type Member struct {
	Uin             float64
	UserName        string
	NickName        string
	AttrStatus      float64
	PYInitial       string
	PYQuanPin       string
	RemarkPYInitial string
	RemarkPYQuanPin string
	MemberStatus    float64
	DisplayName     string
	KeyWord         string
}

群组成员

type MessageEventData

type MessageEventData struct {
	MessageType    MessageType
	IsGroupMessage bool
	IsSendByMySelf bool
	IsAtMe         bool
	MediaUrl       string
	Content        string
	FromUserName   string
	FromUserInfo   Contact
	SenderUserInfo SenderUserInfo
	SenderUserId   string // 根据SendUserName生成ID
	ToUserName     string
	ToUserInfo     Contact
	RecommendInfo  map[string]interface{}
	LocationInfo   LocationInfo
	OriginalMsg    map[string]interface{}
}

消息事件数据

type MessageType

type MessageType int

消息类型

const (
	TextMessage MessageType
	ImgMessage
	VoiceMessage
	VideoMessage
	CardMessage
	LocationMessage
	FriendReqMessage
)

type Response

type Response struct {
	BaseResponse *baseResponse
}

type ScanCodeEventData

type ScanCodeEventData struct {
	UserAvatar string
}

扫码事件数据

type SenderUserInfo

type SenderUserInfo struct {
	UserName string
	NickName string
}

发送人信息

type WeChat

type WeChat struct {
	Uuid string
	// contains filtered or unexported fields
}

func NewWeChat

func NewWeChat(storageFilePath string, logFile io.Writer) *WeChat

New A WeChat

func (*WeChat) Login

func (weChat *WeChat) Login() error

Login And Init

func (*WeChat) Logout

func (weChat *WeChat) Logout()

退出

func (*WeChat) Run

func (weChat *WeChat) Run() error

func (*WeChat) SendAppMsg

func (weChat *WeChat) SendAppMsg(toUserName string, mediaId string, filename string, fileSize int64, ext string) error

发送文件消息

func (*WeChat) SendImgMsg

func (weChat *WeChat) SendImgMsg(toUserFrom string, mediaId string) error

发送图片消息

func (*WeChat) SendTextMsg

func (weChat *WeChat) SendTextMsg(content string, to string) (bool, error)

func (*WeChat) SetListener

func (weChat *WeChat) SetListener(eventType EventType, listener func(Event))

设置事件监听器

func (*WeChat) UploadMedia

func (weChat *WeChat) UploadMedia(buf []byte, mediaType MediaType, fileType string, fileInfo os.FileInfo, toUserName string) (string, error)

上传文件方法

func (*WeChat) VerifyUser

func (weChat *WeChat) VerifyUser(userName string, ticket string, verifyUserContent string) error

授权好友请求

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL