Socket
Socket
Sign inDemoInstall

node-telegram-bot-api

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-telegram-bot-api - npm Package Compare versions

Comparing version 0.18.0 to 0.19.0

20

package.json
{
"name": "node-telegram-bot-api",
"version": "0.18.0",
"version": "0.19.0",
"description": "Telegram Bot API",

@@ -25,17 +25,17 @@ "main": "index.js",

"dependencies": {
"bluebird": "^2.10.1",
"bluebird": "^2.10.2",
"debug": "^2.2.0",
"file-type": "^3.4.0",
"mime": "^1.3.4",
"file-type": "^3.3.1",
"request": "^2.64.0"
"request": "^2.67.0"
},
"devDependencies": {
"contributor": "^0.1.25",
"coveralls": "^2.11.4",
"istanbul": "^0.3.21",
"jsdoc-to-markdown": "^1.2.0",
"jshint": "^2.8.0",
"mocha": "^2.3.3",
"coveralls": "^2.11.6",
"istanbul": "^0.4.1",
"jsdoc-to-markdown": "^1.3.3",
"jshint": "^2.9.1-rc2",
"mocha": "^2.3.4",
"mocha-lcov-reporter": "^1.0.0",
"should": "^7.1.0"
"should": "^8.0.2"
},

@@ -42,0 +42,0 @@ "repository": {

@@ -35,3 +35,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)

### 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)
* * *

@@ -59,21 +60,22 @@

* [TelegramBot](#TelegramBot)
* [new TelegramBot(token, [options])](#new_TelegramBot_new)
* [.getMe()](#TelegramBot+getMe) ⇒ <code>Promise</code>
* [.setWebHook(url, [cert])](#TelegramBot+setWebHook)
* [.getUpdates([timeout], [limit], [offset])](#TelegramBot+getUpdates) ⇒ <code>Promise</code>
* [.sendMessage(chatId, text, [options])](#TelegramBot+sendMessage) ⇒ <code>Promise</code>
* [.forwardMessage(chatId, fromChatId, messageId)](#TelegramBot+forwardMessage) ⇒ <code>Promise</code>
* [.sendPhoto(chatId, photo, [options])](#TelegramBot+sendPhoto) ⇒ <code>Promise</code>
* [.sendAudio(chatId, audio, [options])](#TelegramBot+sendAudio) ⇒ <code>Promise</code>
* [.sendDocument(chatId, doc, [options])](#TelegramBot+sendDocument) ⇒ <code>Promise</code>
* [.sendSticker(chatId, sticker, [options])](#TelegramBot+sendSticker) ⇒ <code>Promise</code>
* [.sendVideo(chatId, video, [options])](#TelegramBot+sendVideo) ⇒ <code>Promise</code>
* [.sendVoice(chatId, voice, [options])](#TelegramBot+sendVoice) ⇒ <code>Promise</code>
* [.sendChatAction(chatId, action)](#TelegramBot+sendChatAction) ⇒ <code>Promise</code>
* [.getUserProfilePhotos(userId, [offset], [limit])](#TelegramBot+getUserProfilePhotos) ⇒ <code>Promise</code>
* [.sendLocation(chatId, latitude, longitude, [options])](#TelegramBot+sendLocation) ⇒ <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>
* [.onText(regexp, callback)](#TelegramBot+onText)
* [new TelegramBot(token, [options])](#new_TelegramBot_new)
* [.getMe()](#TelegramBot+getMe) ⇒ <code>Promise</code>
* [.setWebHook(url, [cert])](#TelegramBot+setWebHook)
* [.getUpdates([timeout], [limit], [offset])](#TelegramBot+getUpdates) ⇒ <code>Promise</code>
* [.sendMessage(chatId, text, [options])](#TelegramBot+sendMessage) ⇒ <code>Promise</code>
* [.answerInlineQuery(inlineQueryId, results, [options])](#TelegramBot+answerInlineQuery) ⇒ <code>Promise</code>
* [.forwardMessage(chatId, fromChatId, messageId)](#TelegramBot+forwardMessage) ⇒ <code>Promise</code>
* [.sendPhoto(chatId, photo, [options])](#TelegramBot+sendPhoto) ⇒ <code>Promise</code>
* [.sendAudio(chatId, audio, [options])](#TelegramBot+sendAudio) ⇒ <code>Promise</code>
* [.sendDocument(chatId, doc, [options])](#TelegramBot+sendDocument) ⇒ <code>Promise</code>
* [.sendSticker(chatId, sticker, [options])](#TelegramBot+sendSticker) ⇒ <code>Promise</code>
* [.sendVideo(chatId, video, [options])](#TelegramBot+sendVideo) ⇒ <code>Promise</code>
* [.sendVoice(chatId, voice, [options])](#TelegramBot+sendVoice) ⇒ <code>Promise</code>
* [.sendChatAction(chatId, action)](#TelegramBot+sendChatAction) ⇒ <code>Promise</code>
* [.getUserProfilePhotos(userId, [offset], [limit])](#TelegramBot+getUserProfilePhotos) ⇒ <code>Promise</code>
* [.sendLocation(chatId, latitude, longitude, [options])](#TelegramBot+sendLocation) ⇒ <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>
* [.onText(regexp, callback)](#TelegramBot+onText)

@@ -143,2 +145,15 @@ <a name="new_TelegramBot_new"></a>

<a name="TelegramBot+answerInlineQuery"></a>
### telegramBot.answerInlineQuery(inlineQueryId, results, [options]) ⇒ <code>Promise</code>
Send answers to an inline query.
**Kind**: instance method of <code>[TelegramBot](#TelegramBot)</code>
**See**: https://core.telegram.org/bots/api#answerinlinequery
| Param | Type | Description |
| --- | --- | --- |
| inlineQueryId | <code>String</code> | Unique identifier of the query |
| results | <code>Array.&lt;InlineQueryResult&gt;</code> | An array of results for the inline query |
| [options] | <code>Object</code> | Additional Telegram query options |
<a name="TelegramBot+forwardMessage"></a>

@@ -218,3 +233,3 @@ ### telegramBot.forwardMessage(chatId, fromChatId, messageId) ⇒ <code>Promise</code>

| chatId | <code>Number</code> &#124; <code>String</code> | Unique identifier for the message recipient |
| video | <code>String</code> &#124; <code>stream.Stream</code> | A file path or Stream. Can also be a `file_id` previously uploaded. |
| video | <code>String</code> &#124; <code>stream.Stream</code> &#124; <code>Buffer</code> | A file path or Stream. Can also be a `file_id` previously uploaded. |
| [options] | <code>Object</code> | Additional Telegram query options |

@@ -221,0 +236,0 @@

@@ -71,4 +71,7 @@ 'use strict';

var message = update.message;
debug('Process Update message %j', 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);

@@ -93,2 +96,8 @@ var processMessageType = function (messageType) {

}
} else if (inline_query) {
debug('Process Update inline_query %j', inline_query);
this.emit('inline_query', inline_query);
} else if (chosen_inline_result) {
debug('Process Update chosen_inline_result %j', chosen_inline_result);
this.emit('chosen_inline_result', chosen_inline_result);
}

@@ -212,2 +221,18 @@ };

/**
* Send answers to an 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 (inlineQueryId, results, options) {
var form = options || {};
form.inline_query_id = inlineQueryId;
form.results = JSON.stringify(results);
return this._request('answerInlineQuery', {form: form});
};
/**
* Forward messages of any kind.

@@ -355,3 +380,3 @@ * @param {Number|String} chatId Unique identifier for the message recipient

* @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.

@@ -358,0 +383,0 @@ * @param {Object} [options] Additional Telegram query options

@@ -371,3 +371,2 @@ 'use strict';

/* Currently unsupported (https://github.com/sindresorhus/file-type/pull/44)
it('should send a video from a Buffer', function (done) {

@@ -381,3 +380,2 @@ var bot = new Telegram(TOKEN);

});
*/
});

@@ -384,0 +382,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc