diff --git a/README.hbs b/README.hbs
index 967b3de..6e5a265 100644
--- a/README.hbs
+++ b/README.hbs
@@ -32,7 +32,7 @@ bot.on('message', function (msg) {
There are some other examples on [examples](https://github.com/yagop/node-telegram-bot-api/tree/master/examples).
### Events
-Every time TelegramBot receives a message, it emits a `message`. Depending on which [message](https://core.telegram.org/bots/api#message) was received, emits an event from this ones: `text`, `audio`, `document`, `photo`, `sticker`, `video`, `voice`, `contact`, `location`, `new_chat_participant`, `left_chat_participant`, `new_chat_title`, `new_chat_photo`, `delete_chat_photo`, `group_chat_created`. Its much better to listen a specific event rather than a `message` in order to stay safe from the content.
+Every time TelegramBot receives a message, it emits a `message`. Depending on which [message](https://core.telegram.org/bots/api#message) was received, emits an event from this ones: `text`, `audio`, `document`, `photo`, `sticker`, `video`, `voice`, `contact`, `location`, `new_chat_participant`, `left_chat_participant`, `new_chat_title`, `new_chat_photo`, `delete_chat_photo`, `group_chat_created`. Its much better to listen a specific event rather than a `message` in order to stay safe from the content.
TelegramBot emits `inline_query` when receives an [https://core.telegram.org/bots/api#inlinequery](Inline Query) and `chosen_inline_result` when receives a [ChosenInlineResult](https://core.telegram.org/bots/api#choseninlineresult). Bot must be enabled on [inline mode](https://core.telegram.org/bots/api#inline-mode)
* * *
diff --git a/README.md b/README.md
index 257e4bf..239c912 100644
--- a/README.md
+++ b/README.md
@@ -32,7 +32,8 @@ bot.on('message', function (msg) {
There are some other examples on [examples](https://github.com/yagop/node-telegram-bot-api/tree/master/examples).
### Events
-Every time TelegramBot receives a message, it emits a `message`. Depending on which [message](https://core.telegram.org/bots/api#message) was received, emits an event from this ones: `text`, `audio`, `document`, `photo`, `sticker`, `video`, `voice`, `contact`, `location`, `new_chat_participant`, `left_chat_participant`, `new_chat_title`, `new_chat_photo`, `delete_chat_photo`, `group_chat_created`. Its much better to listen a specific event rather than a `message` in order to stay safe from the content.
+Every time TelegramBot receives a message, it emits a `message`. Depending on which [message](https://core.telegram.org/bots/api#message) was received, emits an event from this ones: `text`, `audio`, `document`, `photo`, `sticker`, `video`, `voice`, `contact`, `location`, `new_chat_participant`, `left_chat_participant`, `new_chat_title`, `new_chat_photo`, `delete_chat_photo`, `group_chat_created`. Its much better to listen a specific event rather than a `message` in order to stay safe from the content.
+TelegramBot emits `inline_query` when receives an [https://core.telegram.org/bots/api#inlinequery](Inline Query) and `chosen_inline_result` when receives a [ChosenInlineResult](https://core.telegram.org/bots/api#choseninlineresult). Bot must be enabled on [inline mode](https://core.telegram.org/bots/api#inline-mode)
* * *
### WebHooks
@@ -60,6 +61,7 @@ TelegramBot
* [.setWebHook(url, [cert])](#TelegramBot+setWebHook)
* [.getUpdates([timeout], [limit], [offset])](#TelegramBot+getUpdates) ⇒ Promise
* [.sendMessage(chatId, text, [options])](#TelegramBot+sendMessage) ⇒ Promise
+ * [.answerInlineQuery(inlineQueryId, results, [options])](#TelegramBot+answerInlineQuery) ⇒ Promise
* [.forwardMessage(chatId, fromChatId, messageId)](#TelegramBot+forwardMessage) ⇒ Promise
* [.sendPhoto(chatId, photo, [options])](#TelegramBot+sendPhoto) ⇒ Promise
* [.sendAudio(chatId, audio, [options])](#TelegramBot+sendAudio) ⇒ Promise
@@ -138,6 +140,19 @@ Send text message.
| text | String
| Text of the message to be sent |
| [options] | Object
| Additional Telegram query options |
+
+### telegramBot.answerInlineQuery(inlineQueryId, results, [options]) ⇒ Promise
+Send answers to an inline query.
+
+**Kind**: instance method of [TelegramBot](#TelegramBot)
+**See**: https://core.telegram.org/bots/api#answerinlinequery
+
+| Param | Type | Description |
+| --- | --- | --- |
+| inlineQueryId | String
| Unique identifier of the query |
+| results | Array.<InlineQueryResult>
| An array of results for the inline query |
+| [options] | Object
| Additional Telegram query options |
+
### telegramBot.forwardMessage(chatId, fromChatId, messageId) ⇒ Promise
Forward messages of any kind.
@@ -212,7 +227,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 |
-| video | String
| stream.Stream
| A file path or Stream. Can also be a `file_id` previously uploaded. |
+| video | String
| stream.Stream
| Buffer
| A file path or Stream. Can also be a `file_id` previously uploaded. |
| [options] | Object
| Additional Telegram query options |
diff --git a/src/telegram.js b/src/telegram.js
index 94cf6bf..4a645bb 100644
--- a/src/telegram.js
+++ b/src/telegram.js
@@ -70,7 +70,7 @@ TelegramBot.prototype._processUpdate = function (update) {
var message = update.message;
var inline_query = update.inline_query;
var chosen_inline_result = update.chosen_inline_result;
-
+
if (message) {
debug('Process Update message %j', message);
this.emit('message', message);
@@ -92,10 +92,10 @@ TelegramBot.prototype._processUpdate = function (update) {
}
});
}
- } else if(inline_query) {
+ } else if (inline_query) {
debug('Process Update inline_query %j', inline_query);
this.emit('inline_query', inline_query);
- } else if(chosen_inline_result) {
+ } else if (chosen_inline_result) {
debug('Process Update chosen_inline_result %j', chosen_inline_result);
this.emit('chosen_inline_result', chosen_inline_result);
}
@@ -217,15 +217,15 @@ TelegramBot.prototype.sendMessage = function (chatId, text, options) {
/**
* Send answers to an inline query.
- * @param {String} queryId Unique identifier of the query
- * @param {Array of InlineQueryResult} results An array of results for the inline query
+ * @param {String} inlineQueryId Unique identifier of the query
+ * @param {InlineQueryResult[]} results An array of results for the inline query
* @param {Object} [options] Additional Telegram query options
* @return {Promise}
* @see https://core.telegram.org/bots/api#answerinlinequery
*/
-TelegramBot.prototype.answerInlineQuery = function (inline_query_id, results, options) {
+TelegramBot.prototype.answerInlineQuery = function (inlineQueryId, results, options) {
var form = options || {};
- form.inline_query_id = inline_query_id;
+ form.inline_query_id = inlineQueryId;
form.results = JSON.stringify(results);
return this._request('answerInlineQuery', {form: form});
};
@@ -374,7 +374,7 @@ 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} video A file path or Stream.
+ * @param {String|stream.Stream|Buffer} video A file path or Stream.
* Can also be a `file_id` previously uploaded.
* @param {Object} [options] Additional Telegram query options
* @return {Promise}