package main

import (
	"fmt"
	WXHook "github.com/goWxHook/goWxHook/core"
	"time"
)

func main() {
	err := WXHook.WxModuleInit(21100, true)
	if err != nil {
		panic(err)
	}
	wxApi := WXHook.WxApi{
		// 消息10秒无应答就超时
		TimeOut: 10, // 上传大文件时记得手动拉长超时
	}
	fmt.Println(wxApi.GetUserWeChatVersion())

	// 注入微信
	uinfo, err := wxApi.InjectWeChat()
	if err != nil {
		panic(err)
	}
	// 登录完成
	fmt.Println(uinfo)
	//wxid_80buxyrw347m12
	//rlist, err := wxApi.GetRoomMember(1, "17736246691@chatroom")
	//fmt.Println(rlist, err)
	lists, err := wxApi.GetFriendList()
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(lists)

	// 保活检测
	for wxApi.Ping() == nil {
		time.Sleep(5 * time.Second)
	}

	fmt.Println("exit")

}
