wechaty / wechaty-puppet-padplus

DEPRECATED: One puppet based on iPad protocal for Wechaty
https://wechaty.js.org/docs/puppet-services/
317 stars 65 forks source link

method start got blocked. #216

Closed JesseWeb closed 4 years ago

JesseWeb commented 4 years ago

1. Versions

2. Describe the bug and reproduce

wechaty instance method start got blocked!

3. To Reproduce

 (
async function(){
const wechaty = Wechaty.instance({
         name: WECHATY_NAME,
         puppet: 'wechaty-puppet-padplus',
         puppetOptions: {
            token: PUPPET_PAD_PLUS_TOKEN
         }
      })
await wechaty.start()
console.log(`bot just get online`)
...other stuff here
})()

4. Expected behavior

terminal will print bot just get online

5. Actual behavior

none of has been printed.

6. Additional context

in fact. the process are stuck at await wechaty.start()

but in the documentation. it says

await bot.start()
// do other stuff with bot here
// All the bot operation needs to be triggered after start() is done

i am confused!!! am i doing the wrong way?

[bug]

huan commented 4 years ago

The wechaty.start() should return a Promise which will be resolved after it initialized all the tasks for starting.

If it not resolved at all, then it should be treated as a BUG.

I guess it might be related to https://github.com/wechaty/wechaty-puppet-padplus/issues/189

su-chang commented 4 years ago

Sorry, this problem will be fixed when the padplus server update tonight.

JesseWeb commented 4 years ago

one question.
are these lifecycles(down below) consistent?

if is not then what's the different between these two.

1、

bot.start().then(()=>{
    //context
})

2、

bot.on("login",()=>{
  //context
})
su-chang commented 4 years ago

bot.on(event, callback) listener on event

bot.start() start the bot

JesseWeb commented 4 years ago

bot.on(event, callback) listener on event

bot.start() start the bot

is start method resolved after it initialized contains first login event?

huan commented 4 years ago

No, there's no guarantee of any order to be consistent.

It is heavily depends on the puppet implementation.

su-chang commented 4 years ago

@JesseWeb The server has already updated, please check this issue again, if there's no problem about it, please close it. Thank you very much.

JesseWeb commented 4 years ago

@su-chang Aye-Aye, Captain!