From 9c7adddb0a7fbf930a239a1e71d2fb596c35eaf3 Mon Sep 17 00:00:00 2001 From: Ali Movahedi Date: Tue, 12 Sep 2017 20:26:28 +0430 Subject: [PATCH] perf: remove if for checking customMessage --- src/index.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/index.js b/src/index.js index 40a4ef3..c810269 100644 --- a/src/index.js +++ b/src/index.js @@ -215,13 +215,9 @@ export default class Bot extends EventEmitter { const customMessage = ev.customMessage; for (const param of requiredParams) { - let ga; - if (customMessage[param]) { - ga = new Message().to(msg.chat.id).text(customMessage[param]); - } else { - ga = new Message().to(msg.chat.id) - .text(`Enter value for ${param}`); - } + const ga = new Message() + .to(msg.chat.id) + .text(customMessage[param] || `Enter value for ${param}`); yield bot.send(ga).then(answer => { args[param] = answer.text; });