From bfb047312bc72487ff606c786c9f547bfb87e894 Mon Sep 17 00:00:00 2001 From: Yago Date: Sun, 3 Jan 2016 17:20:34 +0100 Subject: [PATCH] Update docs --- README.hbs | 2 +- README.md | 25 +++++++++++++------------ package.json | 2 +- src/telegram.js | 22 +++++++++++----------- 4 files changed, 26 insertions(+), 25 deletions(-) diff --git a/README.hbs b/README.hbs index 13f381f..9609047 100644 --- a/README.hbs +++ b/README.hbs @@ -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. diff --git a/README.md b/README.md index cb402c0..257e4bf 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ var token = 'YOUR_TELEGRAM_BOT_TOKEN'; // Setup polling way var bot = new TelegramBot(token, {polling: true}); +// Matches /echo [whatever] bot.onText(/\/echo (.+)/, function (msg, match) { var fromId = msg.from.id; var resp = match[1]; @@ -62,9 +63,9 @@ TelegramBot * [.forwardMessage(chatId, fromChatId, messageId)](#TelegramBot+forwardMessage) ⇒ Promise * [.sendPhoto(chatId, photo, [options])](#TelegramBot+sendPhoto) ⇒ Promise * [.sendAudio(chatId, audio, [options])](#TelegramBot+sendAudio) ⇒ Promise - * [.sendDocument(chatId, A, [options])](#TelegramBot+sendDocument) ⇒ Promise - * [.sendSticker(chatId, A, [options])](#TelegramBot+sendSticker) ⇒ Promise - * [.sendVideo(chatId, A, [options])](#TelegramBot+sendVideo) ⇒ Promise + * [.sendDocument(chatId, doc, [options])](#TelegramBot+sendDocument) ⇒ Promise + * [.sendSticker(chatId, sticker, [options])](#TelegramBot+sendSticker) ⇒ Promise + * [.sendVideo(chatId, video, [options])](#TelegramBot+sendVideo) ⇒ Promise * [.sendVoice(chatId, voice, [options])](#TelegramBot+sendVoice) ⇒ Promise * [.sendChatAction(chatId, action)](#TelegramBot+sendChatAction) ⇒ Promise * [.getUserProfilePhotos(userId, [offset], [limit])](#TelegramBot+getUserProfilePhotos) ⇒ Promise @@ -159,7 +160,7 @@ Send photo | Param | Type | Description | | --- | --- | --- | | chatId | Number | String | Unique identifier for the message recipient | -| photo | String | stream.Stream | A file path or a Stream. Can also be a `file_id` previously uploaded | +| photo | String | stream.Stream | Buffer | A file path or a Stream. Can also be a `file_id` previously uploaded | | [options] | Object | Additional Telegram query options | @@ -172,11 +173,11 @@ Send audio | Param | Type | Description | | --- | --- | --- | | chatId | Number | String | Unique identifier for the message recipient | -| audio | String | stream.Stream | A file path or a Stream. Can also be a `file_id` previously uploaded. | +| audio | String | stream.Stream | Buffer | A file path, Stream or Buffer. Can also be a `file_id` previously uploaded. | | [options] | Object | Additional Telegram query options | -### telegramBot.sendDocument(chatId, A, [options]) ⇒ Promise +### telegramBot.sendDocument(chatId, doc, [options]) ⇒ Promise Send Document **Kind**: instance method of [TelegramBot](#TelegramBot) @@ -185,11 +186,11 @@ Send Document | Param | Type | Description | | --- | --- | --- | | chatId | Number | String | Unique identifier for the message recipient | -| A | String | stream.Stream | file path or a Stream. Can also be a `file_id` previously uploaded. | +| doc | String | stream.Stream | Buffer | A file path, Stream or Buffer. Can also be a `file_id` previously uploaded. | | [options] | Object | Additional Telegram query options | -### telegramBot.sendSticker(chatId, A, [options]) ⇒ Promise +### telegramBot.sendSticker(chatId, sticker, [options]) ⇒ Promise Send .webp stickers. **Kind**: instance method of [TelegramBot](#TelegramBot) @@ -198,11 +199,11 @@ Send .webp stickers. | Param | Type | Description | | --- | --- | --- | | chatId | Number | String | Unique identifier for the message recipient | -| A | String | stream.Stream | file path or a Stream. Can also be a `file_id` previously uploaded. | +| sticker | String | stream.Stream | Buffer | A file path, Stream or Buffer. Can also be a `file_id` previously uploaded. Stickers are WebP format files. | | [options] | Object | Additional Telegram query options | -### telegramBot.sendVideo(chatId, A, [options]) ⇒ Promise +### telegramBot.sendVideo(chatId, video, [options]) ⇒ Promise Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). **Kind**: instance method of [TelegramBot](#TelegramBot) @@ -211,7 +212,7 @@ Use this method to send video files, Telegram clients support mp4 videos (other | Param | Type | Description | | --- | --- | --- | | chatId | Number | String | Unique identifier for the message recipient | -| A | String | stream.Stream | file path or a Stream. Can also be a `file_id` previously uploaded. | +| video | String | stream.Stream | A file path or Stream. Can also be a `file_id` previously uploaded. | | [options] | Object | Additional Telegram query options | @@ -224,7 +225,7 @@ Send voice | Param | Type | Description | | --- | --- | --- | | chatId | Number | String | Unique identifier for the message recipient | -| voice | String | stream.Stream | A file path or a Stream. Can also be a `file_id` previously uploaded. | +| voice | String | stream.Stream | Buffer | A file path, Stream or Buffer. Can also be a `file_id` previously uploaded. | | [options] | Object | Additional Telegram query options | diff --git a/package.json b/package.json index c99e241..bca222d 100644 --- a/package.json +++ b/package.json @@ -147,4 +147,4 @@ "hireable": true } ] -} \ No newline at end of file +} diff --git a/src/telegram.js b/src/telegram.js index e2c28bf..f11ba80 100644 --- a/src/telegram.js +++ b/src/telegram.js @@ -269,7 +269,7 @@ TelegramBot.prototype._formatSendData = function (type, data) { /** * Send photo * @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 * @param {Object} [options] Additional Telegram query options * @return {Promise} @@ -289,8 +289,8 @@ TelegramBot.prototype.sendPhoto = function (chatId, photo, options) { /** * Send audio * @param {Number|String} chatId Unique identifier for the message recipient - * @param {String|stream.Stream} audio A file path or a Stream. Can - * also be a `file_id` previously uploaded. + * @param {String|stream.Stream|Buffer} audio A file path, Stream or Buffer. + * Can also be a `file_id` previously uploaded. * @param {Object} [options] Additional Telegram query options * @return {Promise} * @see https://core.telegram.org/bots/api#sendaudio @@ -309,8 +309,8 @@ TelegramBot.prototype.sendAudio = function (chatId, audio, options) { /** * Send Document * @param {Number|String} chatId Unique identifier for the message recipient - * @param {String|stream.Stream} A file path or a Stream. Can - * also be a `file_id` previously uploaded. + * @param {String|stream.Stream|Buffer} doc A file path, Stream or Buffer. + * Can also be a `file_id` previously uploaded. * @param {Object} [options] Additional Telegram query options * @return {Promise} * @see https://core.telegram.org/bots/api#sendDocument @@ -329,8 +329,8 @@ TelegramBot.prototype.sendDocument = function (chatId, doc, options) { /** * Send .webp stickers. * @param {Number|String} chatId Unique identifier for the message recipient - * @param {String|stream.Stream} A file path or a Stream. Can - * also be a `file_id` previously uploaded. + * @param {String|stream.Stream|Buffer} sticker A file path, Stream or Buffer. + * Can also be a `file_id` previously uploaded. Stickers are WebP format files. * @param {Object} [options] Additional Telegram query options * @return {Promise} * @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). * @param {Number|String} chatId Unique identifier for the message recipient - * @param {String|stream.Stream} A file path or a Stream. Can - * also be a `file_id` previously uploaded. + * @param {String|stream.Stream} video A file path or Stream. + * Can also be a `file_id` previously uploaded. * @param {Object} [options] Additional Telegram query options * @return {Promise} * @see https://core.telegram.org/bots/api#sendvideo @@ -369,8 +369,8 @@ TelegramBot.prototype.sendVideo = function (chatId, video, options) { /** * Send voice * @param {Number|String} chatId Unique identifier for the message recipient - * @param {String|stream.Stream} voice A file path or a Stream. Can - * also be a `file_id` previously uploaded. + * @param {String|stream.Stream|Buffer} voice A file path, Stream or Buffer. + * Can also be a `file_id` previously uploaded. * @param {Object} [options] Additional Telegram query options * @return {Promise} * @see https://core.telegram.org/bots/api#sendvoice