Comments (10)
Commit 5deed83 has implemented it(check QR code is scanned every 15 seconds, if not scanned new QR code will be generated).
This workaround is acceptable because it resolves a blocker defect problem in the previous version.
Please go-ahead to implement it, and I hope we can find a better way to improve it in the future.
Thank you very much for the effort!
from puppet-oicq.
Currently, the problem is after user scans the qr code and press login on their phone, oicq puppet could not monitor the QR code scanned event from protocolscanned event from Tencent server).
Due to oicq didn't implement monitoring user scanning QR code event part, we should received a ender pressed from terminal(or wechaty should use call some function) to notice puppet QR code has been scanned and oicq should log in.)
And the perfect restart problem #10 (comment) should also be attributed to the QR code terminal pressing waiting problem.
当用户用手机扫描二维码,并按下登录之后。Tencent的服务器会发送给电脑端,QR code已经被扫描的事件。但这部分并没有被oicq实现。所以oicq需要用户手动按下回车,来告诉oicq应该进行接下来的登录。
对应到wechaty-puppet-oicq上来,仍然需要用户扫码后手动告诉我们的程序,二维码已经被扫描,可以进行接下来的登录。
完美重启问题,应该也跟puppet在等待键盘输入有关。
可能需要一段时间来思考这部分如何work around
from puppet-oicq.
当用户用手机扫描二维码,并按下登录之后。Tencent的服务器会发送给电脑端,QR code已经被扫描的事件。但这部分并没有被oicq实现。所以oicq需要用户手动按下回车,来告诉oicq应该进行接下来的登录。
可能需要一段时间来思考这部分如何work around
Have you got any ideas about the workaround?
Waiting for the user to press enter from the stdin will make this puppet very hard to use.
from puppet-oicq.
Current workaround is: after QR code show, bot will wait 20 seconds. If user scan on phone in 20 seconds, bot will login successfully, otherwise a new QR code will be shown.(due to timeout set by QQ)
every 20 seconds:
18:47:13 VERB check if QR code is scanned (try to login) if not scanned, new QR code will be shown
from puppet-oicq.
Is the wordaround acceptable?
from puppet-oicq.
This workaround is acceptable because it resolves a blocker defect problem in the previous version.
Please go-ahead to implement it, and I hope we can find a better way to improve it in the future.
Thank you very much for the effort!
from puppet-oicq.
The problem of this implementation is that if user didn't scan QR code in 20 seconds, scanning regenerated QR code will not login successfully(bot will generate QR code every 20 seconds, and scanning it takes no effect).
Further investigation into oicq lib(or add an issue to them) should be taken to figure out how to fix.
this.oicqClient
.on('system.login.qrcode', function (this:any) {
puppetThis.loginCheckInterval = setInterval(() => {
this.login()
log.verbose('check if QR code is scanned (try to login) if not scanned, new QR code will be shown')
}, 20000)
})
this.oicqClient.on('system.online', async function () {
puppetThis.state.on(true)
clearInterval(puppetThis.loginCheckInterval)
})
from puppet-oicq.
If user didn't scan the QR code in 20 seconds(the QR code will be invalid by QQ side), just throw an error and quit. Is it acceptable?
from puppet-oicq.
Bug has been fixed, if user didn't scan QR code in 20 seconds, puppet will regenerate a new one(repeatedly every 20 seconds).
puppetThis.loginCheckInterval === undefined
should be checked before setting interval.
this.oicqClient
.on('system.login.qrcode', function (this:any) {
if (puppetThis.loginCheckInterval === undefined) {
puppetThis.loginCheckInterval = setInterval(() => {
this.login()
log.verbose('check if QR code is scanned (try to login) if not scanned, new QR code will be shown')
}, 20000)
}
})
from puppet-oicq.
Fantastic, thank you very much for the improvement!
from puppet-oicq.
Related Issues (20)
- Make the PuppetOICQ to be "perfect restart"-able HOT 2
- Could not run wechaty-getting-started after use npm link HOT 8
- Call for volunteering QQ account: create a QQ group for Wechaty Developers' Home HOT 1
- Support QQ Group message receive & send HOT 14
- Support Friendship receive & accept
- Support RoomInvitation receive & accept HOT 6
- PuppetLoginMixin selfId() is deprecated, use `currentUserId` instead: HOT 2
- Store `data/` data to MemoryCard and load from MemoryCard when start
- `CQ` code parsing HOT 4
- Support to get room member alias in the room.
- Support room events
- Support `room.add()` to invite others join the room.
- Handling breaking changes in oicq v2.x HOT 3
- `Wechaty.Room.find()` not work properly with v1.x
- Support `puppetOptions.qq` using `string` HOT 1
- Support say image: `messageSendImage` HOT 1
- Support say UrlLink: `messageSendUrl` HOT 2
- Support `roomList` to list all the groups that the qq bot has joined HOT 1
- Disable the output message from `oicq` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from puppet-oicq.