Reject Promise at Base.send() method if api request got rejected

This commit is contained in:
Laurynas Karvelis 2018-02-05 16:35:22 +02:00
parent 92f892a467
commit 790f988148

View File

@ -34,11 +34,11 @@ export default class Base extends EventEmitter {
}
let messageId;
return new Promise(resolve => {
return new Promise((resolve, reject) => {
bot.api[this.method](this.properties).then(response => {
messageId = response.result.message_id;
this.emit('message:sent', response);
});
}).catch(reject);
if (this._keyboard.one_time_keyboard) {
this._keyboard.replyMarkup = '';