Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Context #31

Closed
soulfly opened this issue Nov 16, 2016 · 1 comment
Closed

Context #31

soulfly opened this issue Nov 16, 2016 · 1 comment

Comments

@soulfly
Copy link

soulfly commented Nov 16, 2016

Hi there,

let's say I have the following code:

bot.on('/start', msg => {
  let markup = bot.inlineKeyboard([
    [
      bot.inlineButton('Search by name', { callback: '/search_name' }),
      bot.inlineButton('Search by fullname, { callback: '/search_fullname' }),
    ]
  ]);

  return bot.sendMessage(msg.from.id, `Please choose one option`, { markup });
});

bot.on('callbackQuery', function(msg) {

  // Send confirm
  bot.answerCallback(msg.id);

  let response;
  if(msg.data === '/search_name') {
    response = `Please enter a name`;
  } else if(msg.data === '/search_fullname') {
    response = `Please enter a full name`;
  }

  return bot.sendMessage(msg.from.id, response);
});

bot.on('text', msg => {

   // How can I know here is it a name or full name search?
});

I need to know the user's context, what did he choose on previous step

Is it possible with this library?

@kosmodrey
Copy link
Contributor

kosmodrey commented Nov 18, 2016

@soulfly soulfly closed this as completed Nov 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants