wechat

package
v0.0.0-...-a32abf6 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: Unlicense Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AvatarType messageType = "avatar"
)

Variables

View Source
var (
	DefaultTemplateReply = map[string]template{
		"now": {
			Description: fmt.Sprintf("系统时间,例如:%v", common.TimeFullFormat),
			// contains filtered or unexported fields
		},
		"week": {
			Description: fmt.Sprintf("星期几,例如:%v", time.Now().Weekday().String()),
			// contains filtered or unexported fields
		},
		"woami": {
			Description: "微信昵称",
			// contains filtered or unexported fields
		},
	}
)

回复模板

Functions

This section is empty.

Types

type Bot

type Bot struct {
	*openwechat.Bot

	Self     *openwechat.Self
	Messages chan []byte
	// contains filtered or unexported fields
}

func (*Bot) AddReply

func (b *Bot) AddReply(replies []*Reply) (err error)

AddReply 添加自动回复规则

func (*Bot) AddTimerReply

func (b *Bot) AddTimerReply(timerReplies []*TimerReply) (err error)

AddTimerReply 添加定时发送消息

func (*Bot) Chat

func (b *Bot) Chat(wb WsBody)

func (*Bot) CleanMessages

func (b *Bot) CleanMessages()

func (*Bot) FindFriend

func (b *Bot) FindFriend(friendId string) (friend *openwechat.Friend, err error)

func (*Bot) FindGroup

func (b *Bot) FindGroup(groupId string) (group *openwechat.Group, err error)

func (*Bot) Friends

func (b *Bot) Friends() (friends openwechat.Friends, err error)

func (*Bot) Groups

func (b *Bot) Groups() (groups openwechat.Groups, err error)

func (*Bot) LoginCallBack

func (b *Bot) LoginCallBack(body openwechat.CheckLoginResponse)

func (*Bot) ReceiveMessage

func (b *Bot) ReceiveMessage(message []byte) (err error)

func (*Bot) ScanCallBack

func (b *Bot) ScanCallBack(body openwechat.CheckLoginResponse)

func (*Bot) SendMessage

func (b *Bot) SendMessage(wb WsBody)

type ChatMsg

type ChatMsg struct {
	Msg        string `json:"msg"`
	SenderId   string `json:"sender_id"`
	ReceiverId string `json:"receiver_id"`
	OwnerId    string `json:"owner_id"`
	IsGroup    bool   `json:"is_group"`
}

type FriendsGroups

type FriendsGroups struct {
	IsAllFriends   bool     // 是否全部朋友
	ExcludeFriends []string // 排除掉的朋友(优先级高于选中的朋友)
	Friends        []string // 选中的朋友
	IsAllGroups    bool     // 是否全部组群
	ExcludeGroups  []string // 排除掉的群聊(优先级高于选中的群聊)
	Groups         []string // 选中的群聊
}

type Reply

type Reply struct {
	FriendsGroups
	Rules map[string]string // 适配正则
}

type TimerReply

type TimerReply struct {
	FriendsGroups
	Msg     string
	Spec    string
	Times   int
	EntryId int
}

type UserInfo

type UserInfo struct {
	HideInputBarFlag  int    `json:"hide_input_bar_flag"`
	StarFriend        int    `json:"star_friend"`
	Sex               int    `json:"sex"`
	AppAccountFlag    int    `json:"app_account_flag"`
	VerifyFlag        int    `json:"verify_flag"`
	ContactFlag       int    `json:"contact_flag"`
	WebWxPluginSwitch int    `json:"web_wx_plugin_switch"`
	HeadImgFlag       int    `json:"head_img_flag"`
	SnsFlag           int    `json:"sns_flag"`
	IsOwner           int    `json:"is_owner"`
	MemberCount       int    `json:"member_count"`
	ChatRoomId        int    `json:"chat_room_id"`
	UniFriend         int    `json:"uni_friend"`
	OwnerUin          int    `json:"owner_uin"`
	Statues           int    `json:"statues"`
	AttrStatus        int64  `json:"attr_status"`
	Uin               string `json:"uin"`
	Province          string `json:"province"`
	City              string `json:"city"`
	Alias             string `json:"alias"`
	DisplayName       string `json:"display_name"`
	KeyWord           string `json:"key_word"`
	EncryChatRoomId   string `json:"encry_chat_room_id"`
	UserName          string `json:"user_name"`
	NickName          string `json:"nick_name"`
	HeadImgUrl        string `json:"head_img_url"`
	RemarkName        string `json:"remark_name"`
	PYInitial         string `json:"py_initial"`
	PYQuanPin         string `json:"py_quan_pin"`
	RemarkPYInitial   string `json:"remark_py_initial"`
	RemarkPYQuanPin   string `json:"remark_py_quan_pin"`
	Signature         string `json:"signature"`
	HeadImgBase64     string `json:"head_img_base64"`
}

type Wechat

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

func NewWechat

func NewWechat() *Wechat

func (*Wechat) Bot

func (w *Wechat) Bot(uid int64) (weBot *Bot)

func (*Wechat) Friends

func (w *Wechat) Friends(uid int64) (friends openwechat.Friends, err error)

func (*Wechat) GetCurrentUser

func (w *Wechat) GetCurrentUser(uid int64) (self *openwechat.Self, err error)

func (*Wechat) Groups

func (w *Wechat) Groups(uid int64) (groups openwechat.Groups, err error)

func (*Wechat) Qrcode

func (w *Wechat) Qrcode(uid int64, replies []*Reply, timerRelies []*TimerReply) (code string, err error)

type WsBody

type WsBody struct {
	Data      interface{} `json:"data"`
	MsgType   messageType `json:"msg_type"`
	Timestamp int64       `json:"timestamp"`
}

Jump to

Keyboard shortcuts

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