Skip to content
Mahdi Dibaiee edited this page Jul 3, 2015 · 5 revisions

Message

Sends a Message.

Returns a promise which is resolved with the first message received from the target after sending this message. It means you can listen on the users' answer.

Here is the chainable method equivalent of each option:

  • to => chat_id
  • text => text
  • preview => disable_web_page_preview (The option is inversed, e.g. preview(false) will set the option to true, therefore disabling previews)
  • reply => reply_to_message_id
  • keyboard => reply_markup (Accepts a Keyboard instance)
new Message()
    .to(chat.id)
    .text('Hi')
    .preview(false)
    .reply(message_id)
    .keyboard(kb);
const msg = new Message().to(chat.id).text('Wassup?');

bot.send(msg).then(answer => {
  console.log('He said ', answer.text); // He said all fine
});
Clone this wiki locally