Add html and markdown formatting for messages.

This commit is contained in:
axfree 2016-03-16 20:54:15 +09:00
parent cdb5adc71f
commit 91ede6188e

View File

@ -35,6 +35,32 @@ export default class Message extends Base {
return this; return this;
} }
/**
* Set text of the message in HTML format
* @param {string} text Message's content in HTML format
* @return {object} returns the message object
*/
html(text) {
this.properties.parse_mode = 'HTML';
if (text) {
this.properties.text = text;
}
return this;
}
/**
* Set text of the message in Markdown format
* @param {string} text Message's content in Markdown format
* @return {object} returns the message object
*/
markdown(text) {
this.properties.parse_mode = 'Markdown';
if (text) {
this.properties.text = text;
}
return this;
}
/** /**
* Set reply_to_message_id of the message * Set reply_to_message_id of the message
* @param {number} id message_id of the message to reply to * @param {number} id message_id of the message to reply to