forked from 760483/wechat-grpc-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
36 lines (31 loc) · 901 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main
import (
"wechat-client/client"
"wechat-client/client/system"
pb "wechat-client/proto"
)
func main() {
go client.QuickUsernameLogin("mr.zhou", "libgjie123", "lingjie123", "", func(wxUser string, ret *pb.WechatMsg) {
loginSuccess(wxUser, ret.BaseMsg.User.Nickname)
})
//go client.QuickQrcodeLogin("mr.zhou", "", func(wxUser string, ret *pb.WechatMsg) {
// loginSuccess(wxUser, ret.BaseMsg.User.Nickname)
//})
select {}
}
func loginSuccess(wxUser string, nickname []byte) {
print("【" + string(nickname) + " 】登录成功,正在初始化消息系统...\n")
if client.LoginInit(wxUser) == nil {
print("正在拉取历史消息")
for {
if client.SyncMsg(wxUser) == nil {
break
}
print(".")
}
client_system.AsyncCallFunc = client.CallFunc
go client.SendHeartbeat(wxUser)
print("\n初始化完成\n")
}
go client.SyncContactAllDetail(wxUser)
}