Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/telegram.js
Original file line number Diff line number Diff line change
@@ -238,13 +238,13 @@ class TelegramBot extends EventEmitter {
}

_fixAddFileThumbnail(options, opts) {
if (options.thumb) {
if (options.thumbnail) {
if (opts.formData === null) {
opts.formData = {};
}

const attachName = 'photo';
const [formData] = this._formatSendData(attachName, options.thumb.replace('attach://', ''));
const [formData] = this._formatSendData(attachName, options.thumbnail.replace('attach://', ''));

if (formData) {
opts.formData[attachName] = formData[attachName];
8 changes: 4 additions & 4 deletions test/telegram.js
Original file line number Diff line number Diff line change
@@ -730,14 +730,14 @@ describe('TelegramBot', function telegramSuite() {
assert.ok(is.object(resp.audio));
});
});
it('should send an audio file with thumb', function test() {
it('should send an audio file with thumbnail', function test() {
const audio = `${__dirname}/data/audio.mp3`;
const thumbImg = `attach://${__dirname}/data/sticker_thumb.png`;

return bot.sendAudio(USERID, audio, { thumb: thumbImg }).then(resp => {
return bot.sendAudio(USERID, audio, { thumbnail: thumbImg }).then(resp => {
assert.ok(is.object(resp));
assert.ok(is.object(resp.audio));
assert.ok(is.object(resp.audio.thumb));
assert.ok(is.object(resp.audio.thumbnail));
});
});
});
@@ -1916,7 +1916,7 @@ describe('TelegramBot', function telegramSuite() {
utils.handleRatelimit(bot, 'setStickerSetThumbnail', this);
});

it('should set a sticker set thumb', function test() {
it('should set a sticker set thumbnail', function test() {
const stickerThumb = `${__dirname}/data/sticker_thumb.png`;
const stickerPackName = `s${CURRENT_TIMESTAMP}_by_${BOT_USERNAME}`;