perf: remove if for checking customMessage

This commit is contained in:
Ali Movahedi 2017-09-12 20:26:28 +04:30
parent 5754b24912
commit 9c7adddb0a

View File

@ -215,13 +215,9 @@ export default class Bot extends EventEmitter {
const customMessage = ev.customMessage; const customMessage = ev.customMessage;
for (const param of requiredParams) { for (const param of requiredParams) {
let ga; const ga = new Message()
if (customMessage[param]) { .to(msg.chat.id)
ga = new Message().to(msg.chat.id).text(customMessage[param]); .text(customMessage[param] || `Enter value for ${param}`);
} else {
ga = new Message().to(msg.chat.id)
.text(`Enter value for ${param}`);
}
yield bot.send(ga).then(answer => { yield bot.send(ga).then(answer => {
args[param] = answer.text; args[param] = answer.text;
}); });