diff --git a/README.md b/README.md index 5a44b47..8e2c897 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,8 @@ TelegramBot * [.sendChatAction(chatId, action)](#TelegramBot+sendChatAction) ⇒ Promise * [.getUserProfilePhotos(userId, [offset], [limit])](#TelegramBot+getUserProfilePhotos) ⇒ Promise * [.sendLocation(chatId, latitude, longitude, [options])](#TelegramBot+sendLocation) ⇒ Promise + * [.sendVenue(chatId, latitude, longitude, name, address, [options])](#TelegramBot+sendVenue) ⇒ Promise + * [.sendContact(chatId, phone_number, first_name, [options])](#TelegramBot+sendContact) ⇒ Promise * [.getFile(fileId)](#TelegramBot+getFile) ⇒ Promise * [.getFileLink(fileId)](#TelegramBot+getFileLink) ⇒ Promise * [.downloadFile(fileId, downloadDir)](#TelegramBot+downloadFile) ⇒ Promise @@ -306,6 +308,38 @@ Use this method to send point on the map. | longitude | Float | Longitude of location | | [options] | Object | Additional Telegram query options | + + +### telegramBot.sendVenue(chatId, latitude, longitude, name, addressm, [options]) ⇒ Promise +Send venue. +Use this method to send information about a venue. + +**Kind**: instance method of [TelegramBot](#TelegramBot) +**See**: https://core.telegram.org/bots/api#sendVenue + +| Param | Type | Description | +| --- | --- | --- | +| chatId | Number | String | Unique identifier for the message recipient | +| latitude | Float | Latitude of location | +| longitude | Float | Longitude of location | +| name | String | Name of location | +| address | String | Address of location | +| [options] | Object | Additional Telegram query options | + +### telegramBot.sendContact(chatId, phone_number, first_name, [options]) ⇒ Promise +Send contact. +Use this method to send phone contacts. + +**Kind**: instance method of [TelegramBot](#TelegramBot) +**See**: https://core.telegram.org/bots/api#sendContact + +| Param | Type | Description | +| --- | --- | --- | +| chatId | Number | String | Unique identifier for the message recipient | +| phone_number | String | Contact's phone number | +| first_name | String | Contact's first name | +| [options] | Object | Additional Telegram query options | + ### telegramBot.getFile(fileId) ⇒ Promise diff --git a/src/telegram.js b/src/telegram.js index c58447d..956a734 100644 --- a/src/telegram.js +++ b/src/telegram.js @@ -491,6 +491,48 @@ class TelegramBot extends EventEmitter { return this._request('sendLocation', { form }); } + /** + * Send venue. + * Use this method to send information about a venue. + * + * @param {Number|String} chatId Unique identifier for the message recipient + * @param {Float} latitude Latitude of location + * @param {Float} longitude Longitude of location + * @param {String} title Name of the venue + * @param {String} address Address of the venue + * @param {Object} [options] Additional Telegram query options + * @return {Promise} + * @see https://core.telegram.org/bots/api#sendvenue + */ + sendVenue(chatId, latitude, longitude, title, address, form = {}) { + form.chat_id = chatId; + form.latitude = latitude; + form.longitude = longitude; + form.title = title; + form.address = address; + return this._request('sendVenue', { form }); + } + + /** + * Send contact. + * Use this method to send phone contacts. + * + * @param {Number|String} chatId Unique identifier for the message recipient + * @param {String} phone_number Contact's phone number + * @param {String} first_name Contact's first name + * @param {Object} [options] Additional Telegram query options + * @return {Promise} + * @see https://core.telegram.org/bots/api#sendcontact + */ + sendContact(chatId, phone_number, first_name, form = {}) { + form.chat_id = chatId; + form.phone_number = phone_number; + form.first_name = first_name; + return this._request('sendContact', { form }); + } + + + /** * Get file. * Use this method to get basic info about a file and prepare it for downloading.