Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question invalid promise #20

Open
mishachesnokov opened this issue Mar 30, 2016 · 2 comments
Open

Question invalid promise #20

mishachesnokov opened this issue Mar 30, 2016 · 2 comments

Comments

@mishachesnokov
Copy link

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 ?

@mdibaiee
Copy link
Owner

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
Copy link
Contributor

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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants