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

is markup only avaliable for one event only? #29

Closed
frengkys opened this issue Oct 4, 2016 · 1 comment
Closed

is markup only avaliable for one event only? #29

frengkys opened this issue Oct 4, 2016 · 1 comment

Comments

@frengkys
Copy link

frengkys commented Oct 4, 2016

i wonder is it true that telebot just accept one markup on one event only?
this is work for first markup but dont with other markup on else statement....

for example
bot.on('text', msg =>{
if (msg.text=="yes")
{ let markup = bot.keyboard([
['test yoyow']
], { resize: true})
return bot.sendMessage(
msg.from.id, 'yoyow' ,{ask : 'day', markup, parse: 'html'}
}
else
{
let markup = bot.keyboard([
['test yayai']
], { resize: true})
return bot.sendMessage(
msg.from.id, 'yayai' ,{ask : 'day', markup, parse: 'html'}
}
}
})

@kosmodrey
Copy link
Contributor

Yes, you can pass only one markup object in event.

Your code should work, as this example:

bot.on('text', msg => {
  const id = msg.from.id;
  const message = msg.text;

  if (message == 'hello') {

    let markup = bot.keyboard([
      ['hello button']
    ], { resize: true });

    return bot.sendMessage(id, 'Hello :)', { markup });

  } else {

    let markup = bot.keyboard([
      ['bye button']
    ], { resize: true });

    return bot.sendMessage(id, 'Bye :(', { markup });

  }
});

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

3 participants