简体   繁体   English

向电报机器人后退一步(使用ReplyKeyboardMarkup)

[英]backward one step in telegram bot (using ReplyKeyboardMarkup)

I'm new in telegram-Bot programming. 我是电报自动编程的新手。

We have a menu in a bot (using ReplyKeyboardMarkup) & menu1 has submenu1,submenu2,submenu3 & submenu1 has submenu1-1 & submneu1-2 我们在机器人中有一个菜单(使用ReplyKeyboardMarkup),而menu1具有submenu1,submenu2,submenu3和submenu1具有submenu1-1和submneu1-2

now i'm in submneu1-2 how can backward one step? 现在我在submneu1-2中如何后退一步? (From submneu1-2 -> submenu1 ) (从submneu1-2-> submenu1)

there is no such a method in telegram bot API in order to do it. 在电报bot API中没有这样做的方法。 its more like designing problem. 它更像是设计问题。 but anyway. 但无论如何。 the solution is keeping session for users. 解决方案是保持用户会话。 you have to save the user current session. 您必须保存用户当前会话。 for example if user sent the submenu1 and then submenu1-1, you should take him/her back to submenu1 if he/she press the back button. 例如,如果用户先发送了submenu1,然后又发送了submenu1-1,则如果他/她按了返回按钮,则应将其带回到submenu1。

but there is an alternative way. 但是还有另一种方法。 you can use the unique back buttons. 您可以使用独特的后退按钮。 this way you can simply manage the requests. 这样,您可以简单地管理请求。 for example you can have BackToMain and BackToFirstMenu instead simple back button. 例如,您可以使用BackToMain和BackToFirstMenu代替简单的后退按钮。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM