mirror of
https://github.com/yagop/node-telegram-bot-api
synced 2025-09-02 23:35:42 +00:00
[telegram] Add constructor option, 'filepath'
Feature: The constructor option, 'filepath', allows us to remove the TelegramBot's behaviour of allowing users to pass in file-paths as arguments, as it involves some operations that might be (are) strongly against what a programmer wishes to achieve with the library. Expect this to be documented better in the near future. Implementation: * Backwards compatible: The default behavior is not changed!
This commit is contained in:
@@ -971,5 +971,13 @@ describe('TelegramBot', function telegramSuite() {
|
||||
assert.ok(is.array(resp.photo));
|
||||
});
|
||||
});
|
||||
it('should not accept file-paths if disallowed with constructor option', function test() {
|
||||
const tgbot = new TelegramBot(TOKEN, { filepath: false });
|
||||
const photo = `${__dirname}/data/photo.gif`;
|
||||
return tgbot.sendPhoto(USERID, photo).catch(err => {
|
||||
// TODO: check for error in a better way
|
||||
assert.ok(err.response.body.indexOf('Bad Request') !== -1);
|
||||
});
|
||||
});
|
||||
});
|
||||
}); // End Telegram
|
||||
|
Reference in New Issue
Block a user