feat: customizable message for required params #36

Merged
amovah merged 4 commits from master into master 2017-09-12 16:04:27 +00:00
Showing only changes of commit 9c7adddb0a - Show all commits

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;
}); });