MCPcopy Create free account
hub / github.com/djun/wechatbot / Run

Function Run

bootstrap/bootstrap.go:11–32  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9
10
11func Run() {
12 //bot := openwechat.DefaultBot()
13 bot := openwechat.DefaultBot(openwechat.Desktop) // 桌面模式,上面登录不上的可以尝试切换这种模式
14
15 // 注册消息处理函数
16 bot.MessageHandler = handlers.Handler
17 // 注册登陆二维码回调
18 bot.UUIDCallback = openwechat.PrintlnQrcodeUrl
19
20 // 创建热存储容器对象
21 reloadStorage := openwechat.NewJsonFileHotReloadStorage("storage.json")
22 // 执行热登录
23 err := bot.HotLogin(reloadStorage)
24 if err != nil {
25 if err = bot.Login(); err != nil {
26 log.Printf("login error: %v \n", err)
27 return
28 }
29 }
30 // 阻塞主goroutine, 直到发生异常或者用户主动退出
31 bot.Block()
32}

Callers 1

mainFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected