fix: default param value to true to avoid breaking people's existing code; small return value fix

This commit is contained in:
Laurynas Karvelis 2018-12-24 13:56:33 +02:00
parent 896ef4e84c
commit 68eb5e5483

View File

@ -28,7 +28,7 @@ export default class Base extends EventEmitter {
* @param {boolean} expectAnswer whether a sent message expects an answer from a contact(s)
* @return {Promise} returns a promise, resolved with message:answer
*/
send(bot, expectAnswer = false) {
send(bot, expectAnswer = true) {
if (this._keyboard) {
const replyMarkup = JSON.stringify(this._keyboard.getProperties());
this.properties.reply_markup = replyMarkup;
@ -43,7 +43,8 @@ export default class Base extends EventEmitter {
.then(messageId => {
if (!expectAnswer) {
// no need to add more event callbacks for the messages that don't need expect an answer
return resolve();
resolve();
return;
}
const chat = this.properties.chat_id;
@ -73,8 +74,6 @@ export default class Base extends EventEmitter {
bot.removeListener('update', listener);
}
});
return void 0;
})
.catch(reject)
.finally(() => {