电报bot预填充文本供用户编辑 [英] telegram bot prefill text for user to edit

查看:113
本文介绍了电报bot预填充文本供用户编辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Telegram机器人向我发送一条带有文本片段的消息,我想对其进行编辑,然后发送回该机器人以进行进一步处理.

复制和粘贴需要时间.重新输入消息需要时间.

理想情况下,我想在机器人的消息上按一个内联按钮编辑",并使消息文本显示在我的回复输入框中进行编辑.(附加到我的回复上的消息ID可能是加号)./p>

我尝试对/start *以外的参数使用深度链接,但这似乎不起作用.

我可以使用bot API(或任何其他电报API)在输入框中准备好文本进行编辑吗?

解决方案

在官方应用中不可能.您的问题是关于草稿的使用-两个API中都没有创建或清除草稿的方法.


尽管如此,您仍可以派生存储在 GiHub 上的任何官方应用程序,并实现所需的功能您可能更喜欢用一种困难的方法,但是与复制/过去的解决方案相比,它要容易得多,不是吗?


UPD

我可以为您提供解决问题的新思路-希望对您有所帮助.

这与 switch_inline_query_current_chat 字段有关> InlineKeyboardButton .只需在要编辑的邮件上附加一个内联按钮即可.设置从收到的消息中获取的该字段的文本,按下后,您将获得该文本到您的输入区域.一切似乎都不错,但是您还将在文本之前输入bot的用户名.

Telegram bot sends me a message with a text snippet, which I want to edit, and send back to the bot for further processing.

Copy and paste takes time. Typing message anew takes time.

Ideally I'd like to press an inline button "Edit" on the bot's message and get the message text appear in my reply input box for editing.(A message id attached to my reply somehow would be a plus).

I tried to use deep linking with parameters other than /start*, but that doesn't seem to work.

Can I use bot API (or any other telegram API) to have text ready for editing in my input box?

解决方案

It's impossible in official apps yet. Your question is about working with drafts - there are no methods in both API to create them or clear.


Nevertheless, you could fork any official app stored on GiHub and implement what you need if you would prefer a hard way, but compared to that copy/past solution seems much more easier, isn't it?


UPD

I can offer to you a new idea how to solve your problem - hope it will be helpful.

This is about switch_inline_query_current_chat field of InlineKeyboardButton. Just attach an inline button to messages you need to edit. Set a text for this field gotten from recieved message and after pressing you will get this text to your input area. All seems good, but you will take bot's username before the text also.

这篇关于电报bot预填充文本供用户编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆