Question invalid promise #20

Open
opened 2016-03-30 12:34:51 +00:00 by mishachesnokov · 2 comments
mishachesnokov commented 2016-03-30 12:34:51 +00:00 (Migrated from github.com)

When using Question and typing an answer instead of tapping a button, invalid promise seems not to work.

var question = new Question()
                          .text('Pick something, do not type')
                          .answers([['1'], ['2']])
                          .to(message.chat.id);
            bot.send(question).then(message => {
                console.log('Valid Answer:', message.text);
                if (message.text == '1') {
                    console.log('1 is OK');
                } else if (message.text == '2') {
                    console.log('2 is OK');
                }
            }, message => {
                console.log('Invalid:', message.text);
            });

Do I understand it correctly: if don't tap any button and type something different then Invalid should be logged to console ?

When using Question and typing an answer instead of tapping a button, invalid promise seems not to work. ``` javascript var question = new Question() .text('Pick something, do not type') .answers([['1'], ['2']]) .to(message.chat.id); bot.send(question).then(message => { console.log('Valid Answer:', message.text); if (message.text == '1') { console.log('1 is OK'); } else if (message.text == '2') { console.log('2 is OK'); } }, message => { console.log('Invalid:', message.text); }); ``` Do I understand it correctly: if don't tap any button and type something different then Invalid should be logged to console ?
mdibaiee commented 2016-04-16 13:37:18 +00:00 (Migrated from github.com)

It seems you are right, there is a problem with promises, although I'm not sure about the reason.

Sadly I don't have time to put on this module right now, but pull-requests are always welcome.

It seems you are right, there is a problem with promises, although I'm not sure about the reason. Sadly I don't have time to put on this module right now, but pull-requests are always welcome.
laurynas-karvelis commented 2018-12-24 10:07:42 +00:00 (Migrated from github.com)

I've tried reproducing your code @mishachesnokov, all worked exactly like you intended, selecting an answer or typing whitelisted and even unsupported answer worked like your code intended.

I've tried reproducing your code @mishachesnokov, all worked exactly like you intended, selecting an answer or typing whitelisted and even unsupported answer worked like your code intended.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: thereadme/node-telegram-api#20
No description provided.