2
0
mirror of https://github.com/yagop/node-telegram-bot-api synced 2025-08-29 05:17:41 +00:00

[pr] PR #124: Merge branch 'master' of https://github.com/Tketa/node-telegram-bot-api into pr/124

This commit is contained in:
GochoMugo 2016-11-10 18:12:30 +03:00
commit 9f79ba8b3b
No known key found for this signature in database
GPG Key ID: 7B6A01CB57AA39E4
2 changed files with 37 additions and 1 deletions

View File

@ -83,6 +83,7 @@ TelegramBot
* [.getUserProfilePhotos(userId, [offset], [limit])](#TelegramBot+getUserProfilePhotos) ⇒ <code>Promise</code>
* [.sendLocation(chatId, latitude, longitude, [options])](#TelegramBot+sendLocation) ⇒ <code>Promise</code>
* [.sendVenue(chatId, latitude, longitude, title, address, [options])](#TelegramBot+sendVenue) ⇒ <code>Promise</code>
* [.sendContact(chatId, phone_number, first_name, [options])](#TelegramBot+sendContact) ⇒ <code>Promise</code>
* [.getFile(fileId)](#TelegramBot+getFile) ⇒ <code>Promise</code>
* [.getFileLink(fileId)](#TelegramBot+getFileLink) ⇒ <code>Promise</code>
* [.downloadFile(fileId, downloadDir)](#TelegramBot+downloadFile) ⇒ <code>Promise</code>
@ -115,7 +116,7 @@ Emits `message` when a message arrives.
| [options.webHook] | <code>Boolean</code> &#124; <code>Object</code> | <code>false</code> | Set true to enable WebHook or set options |
| [options.webHook.key] | <code>String</code> | | PEM private key to webHook server. |
| [options.webHook.cert] | <code>String</code> | | PEM certificate (public) to webHook server. |
| [options.onlyFirstMatch] | <code>Boolean</code> | <code>false</code> | false: try matching all regexps; true: stop after first match |
| [options.onlyFirstMatch] | <code>Boolean</code> | <code>false</code> | Set to true to stop after first match. Otherwise, all regexps are executed |
<a name="TelegramBot+stopPolling"></a>
@ -456,6 +457,22 @@ Use this method to send information about a venue.
| address | <code>String</code> | Address of the venue |
| [options] | <code>Object</code> | Additional Telegram query options |
<a name="TelegramBot+sendContact"></a>
### telegramBot.sendContact(chatId, phone_number, first_name, [options]) ⇒ <code>Promise</code>
Send contact.
Use this method to send phone contacts.
**Kind**: instance method of <code>[TelegramBot](#TelegramBot)</code>
**See**: https://core.telegram.org/bots/api#sendcontact
| Param | Type | Description |
| --- | --- | --- |
| chatId | <code>Number</code> &#124; <code>String</code> | Unique identifier for the message recipient |
| phone_number | <code>String</code> | Contact's phone number |
| first_name | <code>String</code> | Contact's first name |
| [options] | <code>Object</code> | Additional Telegram query options |
<a name="TelegramBot+getFile"></a>
### telegramBot.getFile(fileId) ⇒ <code>Promise</code>

View File

@ -669,6 +669,25 @@ class TelegramBot extends EventEmitter {
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, phoneNumber, firstName, form = {}) {
form.chat_id = chatId;
form.phone_number = phoneNumber;
form.first_name = firstName;
return this._request('sendContact', { form });
}
/**
* Get file.
* Use this method to get basic info about a file and prepare it for downloading.