examples icon indicating copy to clipboard operation
examples copied to clipboard

Conversations. switching between questions. & input validation

Open mrnuser opened this issue 2 years ago • 5 comments

Hi. I have a quite popular task for which I haven't found any examples.

1. You need to switch between questions.

System:

question 1: How much?
user: 100
question 2: ure good?
user: Yes.
question 3: Want some apples?
user: back
question 2: ure good?
user: back
question 1: How much?

as you can see - the user switched back 2 questions and the bot asked them again. Of course, after the user answers, the bot will move on in the script and the user can also go back.

2. Input validation.

Criterion for user's answer to question 1: parseInt(ctx.message.text). System:

question 1: How much?
user: asdjajsdja
question 1: How much?
user: asaasd
question 1: How much?
user: 100
question 2: ure good?

the bot did not accept the answer until it met the criterion. Of course, this should work in conjunction with point 1 (switching between questions).

mrnuser avatar Jul 24 '23 21:07 mrnuser

Hello! As I wrote to you in chat, you should get a basic understanding of writing code, we told you all morning yesterday how to do everything, but instead you spent the whole day trying to make a loop. What you described above is already in @grammyjs/conversations, like I told you above - learn basic programming and then come back to us =)

Ref: https://grammy.dev/plugins/conversations.html#functions-and-recursion

LWJerri avatar Jul 25 '23 08:07 LWJerri

Hello! As I wrote to you in chat, you should get a basic understanding of writing code, we told you all morning yesterday how to do everything, but instead you spent the whole day trying to make a loop. What you described above is already in @grammyjs/conversations, like I told you above - learn basic programming and then come back to us =)

Ref: https://grammy.dev/plugins/conversations.html#functions-and-recursion

All I've heard from you is use loops. As vague as possible

mrnuser avatar Jul 25 '23 15:07 mrnuser

@KnorpelSenf, can we close this issue?

LWJerri avatar Sep 25 '23 07:09 LWJerri

No. We definitely need more examples with conversations. One of them should cover this issue. We can close it when we add the examples.

KnorpelSenf avatar Oct 02 '23 11:10 KnorpelSenf

I am currently working on the second major version of the conversations plugin. We should wait with this issue until it is released.

KnorpelSenf avatar Oct 16 '23 21:10 KnorpelSenf