songtianyi

Results 117 comments of songtianyi

the session can go hours not days

And the network may not stable. You can add my wechat for quick response :) id `wxsongtianyi` Or join the wechat-go group, you can check the qrcode in wechat-go README

I didn't test the stability of wechat-go, as i know few hours later, the session will broken. > Get https://webpush.web.wechat.com/cgi-bin/mmwebwx-bi.. I have meet this error before, but rarely.

1. 找到UserName ``` friend := session.Cm.GetContactByPYQuanPin("SONGTIANYI") ``` 2. 发送消息 ``` session.SendText("hello", session.Bot.UserName, friend.UserName) ``` **插件里的代码并不是说只有在收消息的时候才能用到,和msg无关的代码都可以拿来在其他地方用**

@yusank 把LoginAndServe用go包起来就行了, 但是有一个问题,在这里你是不知道是否已经登录成功。需要做些改进,写好了告诉你。

@yusank ``` type WeChat struct { session *wxweb.Session } func (wx *WeChat)HandleDebug() { var err error wx.session, err = wxweb.CreateSession(nil, nil, wxweb.TERMINAL_MODE) if err != nil { logs.Error(err) return }...

@yusank 这个方式并不优雅,后续我会加个watch channel,目前可以这么做。

@yusank 这样方式需要微信端来触发,那这样就和插件模式无异了。 无状态推送是可以做的,我的代码对这方面支持的不好,后边会改进,case暂时开放,改进好了再关闭。

If you are not familiar with the wechat working mechanism as i was, it's helpful to print it out to see what's going on.