Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.6.0 to 0.7.0

test/video.mp4

26

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

@@ -44,2 +44,11 @@ "main": "index.js",

{
"name": "Riddler",
"email": "",
"url": "https://github.com/Waterloo",
"contributions": 3,
"additions": 64,
"deletions": 2,
"hireable": true
},
{
"name": "Ilias Ismanalijev",

@@ -57,17 +66,8 @@ "email": "hello@illyism.com",

"url": "https://github.com/yagop",
"contributions": 38,
"additions": 947,
"deletions": 113,
"contributions": 43,
"additions": 1002,
"deletions": 132,
"hireable": true
},
{
"name": "Riddler",
"email": "",
"url": "https://github.com/Waterloo",
"contributions": 3,
"additions": 64,
"deletions": 2,
"hireable": true
}
]
}

@@ -151,2 +151,18 @@

## sendVideo(chatId, A, [options])
Send video files, Telegram clients support mp4 videos (other formats may be sent whith `sendDocument`)
See: https://core.telegram.org/bots/api#sendvideo
### Params:
* **Number|String** *chatId* Unique identifier for the message recipient
* **String|stream.Stream** *A* file path or a Stream. Can also be a `file_id` previously uploaded.
* **Object** *[options]* Additional Telegram query options
### Return:
* **Promise**
## sendChatAction(chatId, action)

@@ -153,0 +169,0 @@

{
"name": "node-telegram-bot-api",
"version": "0.6.0",
"version": "0.7.0",
"description": "Telegram Bot API",

@@ -44,8 +44,8 @@ "main": "index.js",

{
"name": "Riddler",
"email": "",
"url": "https://github.com/Waterloo",
"contributions": 3,
"additions": 64,
"deletions": 2,
"name": "Yago",
"email": "yago@yago.me",
"url": "https://github.com/yagop",
"contributions": 48,
"additions": 1102,
"deletions": 153,
"hireable": true

@@ -63,8 +63,8 @@ },

{
"name": "Yago",
"email": "yago@yago.me",
"url": "https://github.com/yagop",
"contributions": 43,
"additions": 1002,
"deletions": 132,
"name": "Riddler",
"email": "",
"url": "https://github.com/Waterloo",
"contributions": 3,
"additions": 64,
"deletions": 2,
"hireable": true

@@ -71,0 +71,0 @@ }

@@ -176,2 +176,18 @@ [![Build Status](https://travis-ci.org/yagop/node-telegram-bot-api.svg?branch=master)](https://travis-ci.org/yagop/node-telegram-bot-api) [![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)

## sendVideo(chatId, A, [options])
Send video files, Telegram clients support mp4 videos (other formats may be sent whith `sendDocument`)
See: https://core.telegram.org/bots/api#sendvideo
### Params:
* **Number|String** *chatId* Unique identifier for the message recipient
* **String|stream.Stream** *A* file path or a Stream. Can also be a `file_id` previously uploaded.
* **Object** *[options]* Additional Telegram query options
### Return:
* **Promise**
## sendChatAction(chatId, action)

@@ -178,0 +194,0 @@

@@ -339,2 +339,23 @@ var EventEmitter = require('events').EventEmitter;

/**
* Send video files, Telegram clients support mp4 videos (other formats may be sent whith `sendDocument`)
* @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 {Object} [options] Additional Telegram query options
* @return {Promise}
* @see https://core.telegram.org/bots/api#sendvideo
*/
TelegramBot.prototype.sendVideo = function (chatId, video, options) {
var opts = {
qs: options || {}
};
opts.qs.chat_id = chatId;
var content = this._formatSendData('video', video);
opts.formData = content[0];
opts.qs.video = content[1];
return this._request('sendVideo', opts);
};
/**
* Send chat action.

@@ -341,0 +362,0 @@ * `typing` for text messages,

@@ -285,2 +285,42 @@ var Telegram = require('../index');

describe('#sendVideo', function () {
var videoId;
it('should send a video from file', function (done) {
var bot = new Telegram(TOKEN);
var video = __dirname+'/video.mp4';
bot.sendVideo(USERID, video).then(function (resp) {
resp.should.be.an.instanceOf(Object);
videoId = resp.video.file_id;
done();
});
});
it('should send a video from id', function (done) {
var bot = new Telegram(TOKEN);
// Send the same photo as before
bot.sendVideo(USERID, videoId).then(function (resp) {
resp.should.be.an.instanceOf(Object);
done();
});
});
it('should send a video from fs.readStream', function (done) {
var bot = new Telegram(TOKEN);
var video = fs.createReadStream(__dirname+'/video.mp4');
bot.sendVideo(USERID, video).then(function (resp) {
resp.should.be.an.instanceOf(Object);
done();
});
});
it('should send a video from request Stream', function (done) {
var bot = new Telegram(TOKEN);
var sticker = request('http://techslides.com/demos/sample-videos/small.mp4');
bot.sendVideo(USERID, sticker).then(function (resp) {
resp.should.be.an.instanceOf(Object);
done();
});
});
});
});
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