2
0
mirror of https://github.com/yagop/node-telegram-bot-api synced 2025-08-29 13:27:44 +00:00

Update docs

This commit is contained in:
Yago 2016-01-03 17:20:34 +01:00
parent bce2383658
commit bfb047312b
4 changed files with 26 additions and 25 deletions

View File

@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.org/yagop/node-telegram-bot-api.svg?branch=master)](https://travis-ci.org/yagop/node-telegram-bot-api) [![Build status](https://ci.appveyor.com/api/projects/status/ujko6bsum3g5msjh/branch/master?svg=true)](https://ci.appveyor.com/project/yagop/node-telegram-bot-api/branch/master) [![Coverage Status](https://coveralls.io/repos/yagop/node-telegram-bot-api/badge.svg?branch=master)](https://coveralls.io/r/yagop/node-telegram-bot-api?branch=master) [![bitHound Score](https://www.bithound.io/github/yagop/node-telegram-bot-api/badges/score.svg)](https://www.bithound.io/github/yagop/node-telegram-bot-api) [![https://telegram.me/node_telegram_bot_api](https://img.shields.io/badge/Telegram-node__telegram__bot__api-blue.svg)](https://telegram.me/node_telegram_bot_api) [![https://telegram.me/Yago_Perez](https://img.shields.io/badge/Telegram-Yago__Perez-blue.svg)](https://telegram.me/Yago_Perez) [![Build Status](https://travis-ci.org/yagop/node-telegram-bot-api.svg?branch=master)](https://travis-ci.org/yagop/node-telegram-bot-api) [![Build status](https://ci.appveyor.com/api/projects/status/ujko6bsum3g5msjh/branch/master?svg=true)](https://ci.appveyor.com/project/yagop/node-telegram-bot-api/branch/master) [![Coverage Status](https://coveralls.io/repos/yagop/node-telegram-bot-api/badge.svg?branch=master)](https://coveralls.io/r/yagop/node-telegram-bot-api?branch=master) [![bitHound Score](https://www.bithound.io/github/yagop/node-telegram-bot-api/badges/score.svg)](https://www.bithound.io/github/yagop/node-telegram-bot-api) [![https://telegram.me/node_telegram_bot_api](https://img.shields.io/badge/💬 Telegram-node__telegram__bot__api-blue.svg)](https://telegram.me/node_telegram_bot_api) [![https://telegram.me/Yago_Perez](https://img.shields.io/badge/💬 Telegram-Yago__Perez-blue.svg)](https://telegram.me/Yago_Perez)
Node.js module to interact with official [Telegram Bot API](https://core.telegram.org/bots/api). A bot token is needed, to obtain one, talk to [@botfather](https://telegram.me/BotFather) and create a new bot. Node.js module to interact with official [Telegram Bot API](https://core.telegram.org/bots/api). A bot token is needed, to obtain one, talk to [@botfather](https://telegram.me/BotFather) and create a new bot.

View File

@ -13,6 +13,7 @@ var token = 'YOUR_TELEGRAM_BOT_TOKEN';
// Setup polling way // Setup polling way
var bot = new TelegramBot(token, {polling: true}); var bot = new TelegramBot(token, {polling: true});
// Matches /echo [whatever]
bot.onText(/\/echo (.+)/, function (msg, match) { bot.onText(/\/echo (.+)/, function (msg, match) {
var fromId = msg.from.id; var fromId = msg.from.id;
var resp = match[1]; var resp = match[1];
@ -62,9 +63,9 @@ TelegramBot
* [.forwardMessage(chatId, fromChatId, messageId)](#TelegramBot+forwardMessage) ⇒ <code>Promise</code> * [.forwardMessage(chatId, fromChatId, messageId)](#TelegramBot+forwardMessage) ⇒ <code>Promise</code>
* [.sendPhoto(chatId, photo, [options])](#TelegramBot+sendPhoto) ⇒ <code>Promise</code> * [.sendPhoto(chatId, photo, [options])](#TelegramBot+sendPhoto) ⇒ <code>Promise</code>
* [.sendAudio(chatId, audio, [options])](#TelegramBot+sendAudio) ⇒ <code>Promise</code> * [.sendAudio(chatId, audio, [options])](#TelegramBot+sendAudio) ⇒ <code>Promise</code>
* [.sendDocument(chatId, A, [options])](#TelegramBot+sendDocument) ⇒ <code>Promise</code> * [.sendDocument(chatId, doc, [options])](#TelegramBot+sendDocument) ⇒ <code>Promise</code>
* [.sendSticker(chatId, A, [options])](#TelegramBot+sendSticker) ⇒ <code>Promise</code> * [.sendSticker(chatId, sticker, [options])](#TelegramBot+sendSticker) ⇒ <code>Promise</code>
* [.sendVideo(chatId, A, [options])](#TelegramBot+sendVideo) ⇒ <code>Promise</code> * [.sendVideo(chatId, video, [options])](#TelegramBot+sendVideo) ⇒ <code>Promise</code>
* [.sendVoice(chatId, voice, [options])](#TelegramBot+sendVoice) ⇒ <code>Promise</code> * [.sendVoice(chatId, voice, [options])](#TelegramBot+sendVoice) ⇒ <code>Promise</code>
* [.sendChatAction(chatId, action)](#TelegramBot+sendChatAction) ⇒ <code>Promise</code> * [.sendChatAction(chatId, action)](#TelegramBot+sendChatAction) ⇒ <code>Promise</code>
* [.getUserProfilePhotos(userId, [offset], [limit])](#TelegramBot+getUserProfilePhotos) ⇒ <code>Promise</code> * [.getUserProfilePhotos(userId, [offset], [limit])](#TelegramBot+getUserProfilePhotos) ⇒ <code>Promise</code>
@ -159,7 +160,7 @@ Send photo
| Param | Type | Description | | Param | Type | Description |
| --- | --- | --- | | --- | --- | --- |
| chatId | <code>Number</code> &#124; <code>String</code> | Unique identifier for the message recipient | | chatId | <code>Number</code> &#124; <code>String</code> | Unique identifier for the message recipient |
| photo | <code>String</code> &#124; <code>stream.Stream</code> | A file path or a Stream. Can also be a `file_id` previously uploaded | | photo | <code>String</code> &#124; <code>stream.Stream</code> &#124; <code>Buffer</code> | A file path or a Stream. Can also be a `file_id` previously uploaded |
| [options] | <code>Object</code> | Additional Telegram query options | | [options] | <code>Object</code> | Additional Telegram query options |
<a name="TelegramBot+sendAudio"></a> <a name="TelegramBot+sendAudio"></a>
@ -172,11 +173,11 @@ Send audio
| Param | Type | Description | | Param | Type | Description |
| --- | --- | --- | | --- | --- | --- |
| chatId | <code>Number</code> &#124; <code>String</code> | Unique identifier for the message recipient | | chatId | <code>Number</code> &#124; <code>String</code> | Unique identifier for the message recipient |
| audio | <code>String</code> &#124; <code>stream.Stream</code> | A file path or a Stream. Can also be a `file_id` previously uploaded. | | audio | <code>String</code> &#124; <code>stream.Stream</code> &#124; <code>Buffer</code> | A file path, Stream or Buffer. Can also be a `file_id` previously uploaded. |
| [options] | <code>Object</code> | Additional Telegram query options | | [options] | <code>Object</code> | Additional Telegram query options |
<a name="TelegramBot+sendDocument"></a> <a name="TelegramBot+sendDocument"></a>
### telegramBot.sendDocument(chatId, A, [options]) ⇒ <code>Promise</code> ### telegramBot.sendDocument(chatId, doc, [options]) ⇒ <code>Promise</code>
Send Document Send Document
**Kind**: instance method of <code>[TelegramBot](#TelegramBot)</code> **Kind**: instance method of <code>[TelegramBot](#TelegramBot)</code>
@ -185,11 +186,11 @@ Send Document
| Param | Type | Description | | Param | Type | Description |
| --- | --- | --- | | --- | --- | --- |
| chatId | <code>Number</code> &#124; <code>String</code> | Unique identifier for the message recipient | | chatId | <code>Number</code> &#124; <code>String</code> | Unique identifier for the message recipient |
| A | <code>String</code> &#124; <code>stream.Stream</code> | file path or a Stream. Can also be a `file_id` previously uploaded. | | doc | <code>String</code> &#124; <code>stream.Stream</code> &#124; <code>Buffer</code> | A file path, Stream or Buffer. Can also be a `file_id` previously uploaded. |
| [options] | <code>Object</code> | Additional Telegram query options | | [options] | <code>Object</code> | Additional Telegram query options |
<a name="TelegramBot+sendSticker"></a> <a name="TelegramBot+sendSticker"></a>
### telegramBot.sendSticker(chatId, A, [options]) ⇒ <code>Promise</code> ### telegramBot.sendSticker(chatId, sticker, [options]) ⇒ <code>Promise</code>
Send .webp stickers. Send .webp stickers.
**Kind**: instance method of <code>[TelegramBot](#TelegramBot)</code> **Kind**: instance method of <code>[TelegramBot](#TelegramBot)</code>
@ -198,11 +199,11 @@ Send .webp stickers.
| Param | Type | Description | | Param | Type | Description |
| --- | --- | --- | | --- | --- | --- |
| chatId | <code>Number</code> &#124; <code>String</code> | Unique identifier for the message recipient | | chatId | <code>Number</code> &#124; <code>String</code> | Unique identifier for the message recipient |
| A | <code>String</code> &#124; <code>stream.Stream</code> | file path or a Stream. Can also be a `file_id` previously uploaded. | | sticker | <code>String</code> &#124; <code>stream.Stream</code> &#124; <code>Buffer</code> | A file path, Stream or Buffer. Can also be a `file_id` previously uploaded. Stickers are WebP format files. |
| [options] | <code>Object</code> | Additional Telegram query options | | [options] | <code>Object</code> | Additional Telegram query options |
<a name="TelegramBot+sendVideo"></a> <a name="TelegramBot+sendVideo"></a>
### telegramBot.sendVideo(chatId, A, [options]) ⇒ <code>Promise</code> ### telegramBot.sendVideo(chatId, video, [options]) ⇒ <code>Promise</code>
Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document).
**Kind**: instance method of <code>[TelegramBot](#TelegramBot)</code> **Kind**: instance method of <code>[TelegramBot](#TelegramBot)</code>
@ -211,7 +212,7 @@ Use this method to send video files, Telegram clients support mp4 videos (other
| Param | Type | Description | | Param | Type | Description |
| --- | --- | --- | | --- | --- | --- |
| chatId | <code>Number</code> &#124; <code>String</code> | Unique identifier for the message recipient | | chatId | <code>Number</code> &#124; <code>String</code> | Unique identifier for the message recipient |
| A | <code>String</code> &#124; <code>stream.Stream</code> | file path or a Stream. Can also be a `file_id` previously uploaded. | | video | <code>String</code> &#124; <code>stream.Stream</code> | A file path or Stream. Can also be a `file_id` previously uploaded. |
| [options] | <code>Object</code> | Additional Telegram query options | | [options] | <code>Object</code> | Additional Telegram query options |
<a name="TelegramBot+sendVoice"></a> <a name="TelegramBot+sendVoice"></a>
@ -224,7 +225,7 @@ Send voice
| Param | Type | Description | | Param | Type | Description |
| --- | --- | --- | | --- | --- | --- |
| chatId | <code>Number</code> &#124; <code>String</code> | Unique identifier for the message recipient | | chatId | <code>Number</code> &#124; <code>String</code> | Unique identifier for the message recipient |
| voice | <code>String</code> &#124; <code>stream.Stream</code> | A file path or a Stream. Can also be a `file_id` previously uploaded. | | voice | <code>String</code> &#124; <code>stream.Stream</code> &#124; <code>Buffer</code> | A file path, Stream or Buffer. Can also be a `file_id` previously uploaded. |
| [options] | <code>Object</code> | Additional Telegram query options | | [options] | <code>Object</code> | Additional Telegram query options |
<a name="TelegramBot+sendChatAction"></a> <a name="TelegramBot+sendChatAction"></a>

View File

@ -147,4 +147,4 @@
"hireable": true "hireable": true
} }
] ]
} }

View File

@ -269,7 +269,7 @@ TelegramBot.prototype._formatSendData = function (type, data) {
/** /**
* Send photo * Send photo
* @param {Number|String} chatId Unique identifier for the message recipient * @param {Number|String} chatId Unique identifier for the message recipient
* @param {String|stream.Stream} photo A file path or a Stream. Can * @param {String|stream.Stream|Buffer} photo A file path or a Stream. Can
* also be a `file_id` previously uploaded * also be a `file_id` previously uploaded
* @param {Object} [options] Additional Telegram query options * @param {Object} [options] Additional Telegram query options
* @return {Promise} * @return {Promise}
@ -289,8 +289,8 @@ TelegramBot.prototype.sendPhoto = function (chatId, photo, options) {
/** /**
* Send audio * Send audio
* @param {Number|String} chatId Unique identifier for the message recipient * @param {Number|String} chatId Unique identifier for the message recipient
* @param {String|stream.Stream} audio A file path or a Stream. Can * @param {String|stream.Stream|Buffer} audio A file path, Stream or Buffer.
* also be a `file_id` previously uploaded. * Can also be a `file_id` previously uploaded.
* @param {Object} [options] Additional Telegram query options * @param {Object} [options] Additional Telegram query options
* @return {Promise} * @return {Promise}
* @see https://core.telegram.org/bots/api#sendaudio * @see https://core.telegram.org/bots/api#sendaudio
@ -309,8 +309,8 @@ TelegramBot.prototype.sendAudio = function (chatId, audio, options) {
/** /**
* Send Document * Send Document
* @param {Number|String} chatId Unique identifier for the message recipient * @param {Number|String} chatId Unique identifier for the message recipient
* @param {String|stream.Stream} A file path or a Stream. Can * @param {String|stream.Stream|Buffer} doc A file path, Stream or Buffer.
* also be a `file_id` previously uploaded. * Can also be a `file_id` previously uploaded.
* @param {Object} [options] Additional Telegram query options * @param {Object} [options] Additional Telegram query options
* @return {Promise} * @return {Promise}
* @see https://core.telegram.org/bots/api#sendDocument * @see https://core.telegram.org/bots/api#sendDocument
@ -329,8 +329,8 @@ TelegramBot.prototype.sendDocument = function (chatId, doc, options) {
/** /**
* Send .webp stickers. * Send .webp stickers.
* @param {Number|String} chatId Unique identifier for the message recipient * @param {Number|String} chatId Unique identifier for the message recipient
* @param {String|stream.Stream} A file path or a Stream. Can * @param {String|stream.Stream|Buffer} sticker A file path, Stream or Buffer.
* also be a `file_id` previously uploaded. * Can also be a `file_id` previously uploaded. Stickers are WebP format files.
* @param {Object} [options] Additional Telegram query options * @param {Object} [options] Additional Telegram query options
* @return {Promise} * @return {Promise}
* @see https://core.telegram.org/bots/api#sendsticker * @see https://core.telegram.org/bots/api#sendsticker
@ -349,8 +349,8 @@ TelegramBot.prototype.sendSticker = function (chatId, sticker, options) {
/** /**
* Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). * Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document).
* @param {Number|String} chatId Unique identifier for the message recipient * @param {Number|String} chatId Unique identifier for the message recipient
* @param {String|stream.Stream} A file path or a Stream. Can * @param {String|stream.Stream} video A file path or Stream.
* also be a `file_id` previously uploaded. * Can also be a `file_id` previously uploaded.
* @param {Object} [options] Additional Telegram query options * @param {Object} [options] Additional Telegram query options
* @return {Promise} * @return {Promise}
* @see https://core.telegram.org/bots/api#sendvideo * @see https://core.telegram.org/bots/api#sendvideo
@ -369,8 +369,8 @@ TelegramBot.prototype.sendVideo = function (chatId, video, options) {
/** /**
* Send voice * Send voice
* @param {Number|String} chatId Unique identifier for the message recipient * @param {Number|String} chatId Unique identifier for the message recipient
* @param {String|stream.Stream} voice A file path or a Stream. Can * @param {String|stream.Stream|Buffer} voice A file path, Stream or Buffer.
* also be a `file_id` previously uploaded. * Can also be a `file_id` previously uploaded.
* @param {Object} [options] Additional Telegram query options * @param {Object} [options] Additional Telegram query options
* @return {Promise} * @return {Promise}
* @see https://core.telegram.org/bots/api#sendvoice * @see https://core.telegram.org/bots/api#sendvoice