Merge pull request #38 from laurynas-karvelis/master
Allow module consumers to deal with Promise rejections themselves
This commit is contained in:
commit
1273102625
@ -138,7 +138,7 @@ export default class Bot extends EventEmitter {
|
|||||||
* @return {unknown} returns the result of calling message's send method
|
* @return {unknown} returns the result of calling message's send method
|
||||||
*/
|
*/
|
||||||
send(message) {
|
send(message) {
|
||||||
return message.send(this).catch(console.error);
|
return message.send(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,11 +34,11 @@ export default class Base extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let messageId;
|
let messageId;
|
||||||
return new Promise(resolve => {
|
return new Promise((resolve, reject) => {
|
||||||
bot.api[this.method](this.properties).then(response => {
|
bot.api[this.method](this.properties).then(response => {
|
||||||
messageId = response.result.message_id;
|
messageId = response.result.message_id;
|
||||||
this.emit('message:sent', response);
|
this.emit('message:sent', response);
|
||||||
});
|
}).catch(reject);
|
||||||
|
|
||||||
if (this._keyboard.one_time_keyboard) {
|
if (this._keyboard.one_time_keyboard) {
|
||||||
this._keyboard.replyMarkup = '';
|
this._keyboard.replyMarkup = '';
|
||||||
|
Loading…
Reference in New Issue
Block a user