From ba4d207684c123f116efb102557fba9f5c203771 Mon Sep 17 00:00:00 2001 From: GochoMugo Date: Sun, 19 Nov 2017 00:05:32 +0300 Subject: [PATCH] src: Improve performance when matching message types Feature: Considering that the most encountered message type is (probably) 'text', we should match it as soon as possible; without wasting much time looping through less-likely-to-matched types. --- src/telegram.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/telegram.js b/src/telegram.js index f230d3b..61ee885 100644 --- a/src/telegram.js +++ b/src/telegram.js @@ -20,6 +20,7 @@ const deprecate = require('depd')('node-telegram-bot-api'); let Promise = require('bluebird'); const _messageTypes = [ + 'text', 'audio', 'channel_chat_created', 'contact', @@ -40,7 +41,6 @@ const _messageTypes = [ 'sticker', 'successful_payment', 'supergroup_chat_created', - 'text', 'video', 'video_note', 'voice',