mirror of
https://github.com/yagop/node-telegram-bot-api
synced 2025-08-31 14:25:57 +00:00
sendSticker method
This commit is contained in:
@@ -241,5 +241,45 @@ describe('Telegram', function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('#sendSticker', function () {
|
||||
var stickerId;
|
||||
it('should send a sticker from file', function (done) {
|
||||
var bot = new Telegram(TOKEN);
|
||||
var sticker = __dirname+'/sticker.webp';
|
||||
bot.sendSticker(USERID, sticker).then(function (resp) {
|
||||
resp.should.be.an.instanceOf(Object);
|
||||
stickerId = resp.sticker.file_id;
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should send a sticker from id', function (done) {
|
||||
var bot = new Telegram(TOKEN);
|
||||
// Send the same photo as before
|
||||
bot.sendSticker(USERID, stickerId).then(function (resp) {
|
||||
resp.should.be.an.instanceOf(Object);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should send a sticker from fs.readStream', function (done) {
|
||||
var bot = new Telegram(TOKEN);
|
||||
var sticker = fs.createReadStream(__dirname+'/sticker.webp');
|
||||
bot.sendSticker(USERID, sticker).then(function (resp) {
|
||||
resp.should.be.an.instanceOf(Object);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should send a sticker from request Stream', function (done) {
|
||||
var bot = new Telegram(TOKEN);
|
||||
var sticker = request('https://www.gstatic.com/webp/gallery3/1_webp_ll.webp');
|
||||
bot.sendSticker(USERID, sticker).then(function (resp) {
|
||||
resp.should.be.an.instanceOf(Object);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
BIN
test/sticker.webp
Normal file
BIN
test/sticker.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 90 KiB |
Reference in New Issue
Block a user