Wolke / botbuilder-linebot-connector

MIT License
88 stars 16 forks source link

Can't send multiple message when using promise/await #12

Closed tidusvn05 closed 6 years ago

tidusvn05 commented 6 years ago

Hi all,

I just got a problem.

[Env] push: true

[sample Code] session.send("msg 1"); // => be run await function();// => be run

session.send("msg 2"); // => not run console.log("debug 1"); // => be run session.endDialog("") // => not run

As below code, session can't run if wait some seconds from wait/promise function.

Anyone can help me ? Thank in advance!

Wolke commented 6 years ago

can you give me some code ?

tidusvn05 commented 6 years ago

my code in dialog file.


import axios from 'axios';

module.exports = [
  async function(session, args, next) {
    session.send('message 1');
    session.send('message 2');
    // Send the message.
    let response = await axios({
      method:'get',
      url:'http://bit.ly/2mTM3nY',
      responseType:'stream'
    });
    session.endDialog("final message");
    return;
  }
]

Result is: message 1 message 2

Error: don't see final message

Wolke commented 6 years ago

LINE message reply api can not be wait for 2 seconds. If you have to wait for your function. I suggest you to set push api