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

get sended message and gave listener to new job #256

Closed
mrzslr opened this issue Jan 10, 2017 · 4 comments
Closed

get sended message and gave listener to new job #256

mrzslr opened this issue Jan 10, 2017 · 4 comments
Labels

Comments

@mrzslr
Copy link

mrzslr commented Jan 10, 2017

i wanna create a food order bot .
in 3 level i get the name,phone and location . so i need to return listener to next operation in each level.
but when i want listen for phone or location this bot.on('message') is listening yet for name message.
help !


bot.onText(/name/, function onNameEnter(msg) {
    var chatId = msg.chat.id;
    bot.sendMessage(chatId, 'What's your Name?', opts.enterNameOpts).then(function (sended) {
        var chatId = sended.chat.id;
        var messageId = sended.message_id;
        bot.on('message', function (message) {

            // do somthings.
            bot.sendMessage(chatId, 'fine.', opts.productOpts);
        });
    });
});

@hexxone
Copy link

hexxone commented Jan 15, 2017

The problem is, that bot.sendMessage doesnt return any data, but the Promise itself which should look like this:
Promise { _bitField: 0, _fulfillmentHandler0: undefined, _rejectionHandler0: undefined, _progressHandler0: undefined, _promise0: undefined, _receiver0: undefined, _settledValue: undefined }
That is also my problem at the moment, since I need to know my SENT (not sended) message id for later editing.

@kamikazechaser
Copy link
Collaborator

kamikazechaser commented Jan 22, 2017

@mohammadreza2012 What you need is a form-like handler to return name, phone, location repectively at every step. This is currently in the works in tgfancy. You can follow the thread here

@mrzslr
Copy link
Author

mrzslr commented Jan 22, 2017

@kamikazechaser it's not just about form-like handling . it's not worked also for keyboard_buttons.

@kamikazechaser
Copy link
Collaborator

@mohammadreza2012 Refer to the last posts on the thread at #108. Almost similar case there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants