feature: add event listeners to get answers from Base.send method only when explicitly asked #47
@ -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(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user