wechat

package
v0.0.0-...-8b17fe9 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	FromUser  string `json:"fromUser"`
	FromGroup string `json:"fromGroup"`
	ToUser    string `json:"toUser"`
	MsgId     int64  `json:"msgId"`
	NewMsgId  int64  `json:"newMsgId"`
	Timestamp int64  `json:"timestamp"`
	Content   string `json:"content"`
	Self      bool   `json:"self"`
}

type Handler

type Handler func(...interface{})

type Msg

type Msg struct {
	Account     string `json:"account"`
	WcId        string `json:"wcId"`
	MessageType string `json:"messageType"`
	Data        Data   `json:"data"`
}

type MsgHandler

type MsgHandler struct {
	// contains filtered or unexported fields
}

func GetMsgHandler

func GetMsgHandler() *MsgHandler

func (*MsgHandler) Handle

func (m *MsgHandler) Handle(msgName MsgName, data interface{})

func (*MsgHandler) On

func (m *MsgHandler) On(msgName MsgName, handler Handler)

type MsgLogicFunc

type MsgLogicFunc func(msg *Msg)

type MsgName

type MsgName string

type Response

type Response struct {
	Status int32       `json:"status"`
	Msg    string      `json:"msg"`
	Data   interface{} `json:"data"`
}

type Wechat

type Wechat struct {
	WId         string
	WcId        string
	Options     WechatOptions
	WkteamApi   *wkteam.WkteamApi
	MsgHandler  *MsgHandler // 消息处理器
	ContactList map[string]entity.ContactEntity
}

func GetWechatInstance

func GetWechatInstance() *Wechat

func NewWechat

func NewWechat(options WechatOptions) *Wechat

func (*Wechat) Handle

func (w *Wechat) Handle(msgName MsgName, data interface{})

func (*Wechat) On

func (w *Wechat) On(msgName MsgName, handler MsgLogicFunc)

func (*Wechat) Start

func (w *Wechat) Start() error

type WechatOptions

type WechatOptions struct {
	Account  string // 平台登录手机号
	Password string // 平台登录密码
	BaseUrl  string // 请求wkteam的域名信息
	WcId     string // 要登录的微信的微信ID
	AuthKey  string // 使用平台用户名密码获取到的authkey,请求后面接口时都需要带到header里面
	Url      string // 消息回调URL,需要上报到wkteam,
	Port     string // 本地起的gin server服务监听的端口
	Uri      string // 接口URI
}

Jump to

Keyboard shortcuts

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