Skip to content

Commit

Permalink
perf(question): string.includes is more performant than RegExp
Browse files Browse the repository at this point in the history
  • Loading branch information
EdJoPaTo committed Apr 21, 2019
1 parent 66e8c33 commit d3bfa07
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ export default class TelegrafInlineMenu {
ctx.reply(questionText, extra),
ctx.answerCbQuery(),
ctx.deleteMessage()
.catch((error: any) => {
if (/can't be deleted/.test(error)) {
.catch((error: Error) => {
if (error.message.includes('can\'t be deleted')) {
// Looks like message is to old to be deleted
return
}
Expand Down

0 comments on commit d3bfa07

Please sign in to comment.