Coder Social home page Coder Social logo

Comments (10)

anaivebird avatar anaivebird commented on August 24, 2024 1

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.

anaivebird avatar anaivebird commented on August 24, 2024

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.

huan avatar huan commented on August 24, 2024

当用户用手机扫描二维码,并按下登录之后。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.

anaivebird avatar anaivebird commented on August 24, 2024

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.

anaivebird avatar anaivebird commented on August 24, 2024

Is the wordaround acceptable?

from puppet-oicq.

huan avatar huan commented on August 24, 2024

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.

anaivebird avatar anaivebird commented on August 24, 2024

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.

anaivebird avatar anaivebird commented on August 24, 2024

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.

anaivebird avatar anaivebird commented on August 24, 2024

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.

huan avatar huan commented on August 24, 2024

Fantastic, thank you very much for the improvement!

from puppet-oicq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.