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:
parent
bce2383658
commit
bfb047312b
@ -1,4 +1,4 @@
|
|||||||
[](https://travis-ci.org/yagop/node-telegram-bot-api) [](https://ci.appveyor.com/project/yagop/node-telegram-bot-api/branch/master) [](https://coveralls.io/r/yagop/node-telegram-bot-api?branch=master) [](https://www.bithound.io/github/yagop/node-telegram-bot-api) [](https://telegram.me/node_telegram_bot_api) [](https://telegram.me/Yago_Perez)
|
[](https://travis-ci.org/yagop/node-telegram-bot-api) [](https://ci.appveyor.com/project/yagop/node-telegram-bot-api/branch/master) [](https://coveralls.io/r/yagop/node-telegram-bot-api?branch=master) [](https://www.bithound.io/github/yagop/node-telegram-bot-api) [](https://telegram.me/node_telegram_bot_api) [](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.
|
||||||
|
|
||||||
|
25
README.md
25
README.md
@ -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> | <code>String</code> | Unique identifier for the message recipient |
|
| chatId | <code>Number</code> | <code>String</code> | Unique identifier for the message recipient |
|
||||||
| photo | <code>String</code> | <code>stream.Stream</code> | A file path or a Stream. Can also be a `file_id` previously uploaded |
|
| photo | <code>String</code> | <code>stream.Stream</code> | <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> | <code>String</code> | Unique identifier for the message recipient |
|
| chatId | <code>Number</code> | <code>String</code> | Unique identifier for the message recipient |
|
||||||
| audio | <code>String</code> | <code>stream.Stream</code> | A file path or a Stream. Can also be a `file_id` previously uploaded. |
|
| audio | <code>String</code> | <code>stream.Stream</code> | <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> | <code>String</code> | Unique identifier for the message recipient |
|
| chatId | <code>Number</code> | <code>String</code> | Unique identifier for the message recipient |
|
||||||
| A | <code>String</code> | <code>stream.Stream</code> | file path or a Stream. Can also be a `file_id` previously uploaded. |
|
| doc | <code>String</code> | <code>stream.Stream</code> | <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> | <code>String</code> | Unique identifier for the message recipient |
|
| chatId | <code>Number</code> | <code>String</code> | Unique identifier for the message recipient |
|
||||||
| A | <code>String</code> | <code>stream.Stream</code> | file path or a Stream. Can also be a `file_id` previously uploaded. |
|
| sticker | <code>String</code> | <code>stream.Stream</code> | <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> | <code>String</code> | Unique identifier for the message recipient |
|
| chatId | <code>Number</code> | <code>String</code> | Unique identifier for the message recipient |
|
||||||
| A | <code>String</code> | <code>stream.Stream</code> | file path or a Stream. Can also be a `file_id` previously uploaded. |
|
| video | <code>String</code> | <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> | <code>String</code> | Unique identifier for the message recipient |
|
| chatId | <code>Number</code> | <code>String</code> | Unique identifier for the message recipient |
|
||||||
| voice | <code>String</code> | <code>stream.Stream</code> | A file path or a Stream. Can also be a `file_id` previously uploaded. |
|
| voice | <code>String</code> | <code>stream.Stream</code> | <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>
|
||||||
|
@ -147,4 +147,4 @@
|
|||||||
"hireable": true
|
"hireable": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user