Closed QreKer closed 4 years ago
I assume you want to achieve something quite similar to #135. Please also check my response there.
Your authorized menu is probably a menu independent from the main menu (not reachable as a submenu) so you probably need another MenuMiddleware
. If you specify the root path of that MenuMiddleware
as auth/
then you can supply auth/
as third argument of replyMenuToContext
(line 24 in your code).
Currently you set the additionalState
to auth
which is always the same (thats why I suggested to pass it directly in line 24) and does not end with a /
. Thats why the error came up as a path of a menu was expected which end with /
. (A menu always ends with /
, buttons never do)
Also as you want to reply the question (line 40) you probably don't want to update the menu afterwards so i suggest return false
instead.
Hope it helps :) If you have feedback on how to improve the documentation on multiple MenuMiddlewares I'm all ears :)
Hello. Thank you for answer. I tried as you say, also checked #135 but there same issue as like when I'm using "hide". You can check current code with results screenshots: tg.zip
As you can see after the question user not redirected to "auth/" and only will be redirected if manually clicks "test" button again. Also in console screenshot you can see output of 2 console.log on lines 26 and 27. Both says that user answered the question and path that must be user is "auth/". On line 46 I tried both:
Can it happen if I'm using polling and not webhooks? UPD: tested with webhook, same result.
UPD2:
Ok, now I understand the issue. I used await replyMenuToContext(menuTemplate, ctx, additionalState); Which can return only menuTemplate(in my case). I just misunderstood documentation because there no explanation for each argument for replyMenuToContext, you should add this. Or I can post it to this issue on this or next weekdays(have no time now). Keep it open if I can post there an class documentation that should be added to main documentation.
Thank you for your help.
Hello. I want to redirect my user after answering the question to submenu but got an error I don't understand. I'm using such stack: telegraf telegraf-inline-menu telegraf-stateless-question telegram-mysql-session
My current code in attachments as well as error stacktrace. telegrafStatelessQuestion.zip
I will be fine with 2 solutions:
Thank you in advance for your help