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

Types

Message types simplify usage of methods.

All types accept Telegram API defined properties in their constructor, and have equivalent chainable methods to set those properties. You can also use setProperties to set the properties using the official names.

const msg = new Message({chat_id: 9999, text: 'folan'});
const msg = new Message().to(9999).text('folan');

msg.setProperties({text: 'Test'}); // by default, properties are extended by the provided object
console.log(msg.getProperties()); // {chat_id: 9999, text: 'Test'}

msg.setProperties({text: 'folan'}, false); // Replaces the properties object with the provided argument
console.log(msg.getProperties()); // {text: 'folan'}
Clone this wiki locally