How to send a command by clicking a button in Telegram - telegram

How can I create a ReplyKeyboardButton in telegram with a specified text, which sends a specified command when it is being clicked.
For example the text is "Yes" and when I click yes, it sends /1 as a command. In the documentation creating a button just gets a text as input.
Following picture is from Telegram documentation which demonstrate the idea:
https://core.telegram.org/file/811140184/1/5YJxx-rostA/ad3f74094485fb97bd

If you make it an inline-keyboard, each button can have an associated data-value along with the button text.
At present, regular buttons return their text as the reply value in a return message.
However, If you have a unique text or unique text+emoji as the text for each button, then your command processor code can simple do a switch-case on returned message-text

If you mean that when the user presses the button, the user actually sends a command, it is not possible.
When the user presses a regular button (not inline) he just sends the text inside the button.
So the only way to do this is to write a command in the button or at least a command and parameters.
What you see in the picture is the bot that sends a message where you have to possibility to answer: pressing buttons or pressing commands in the message.
Anyway you can also use the same functions to handle a command and a button.

Related

Xamarin Entry focus control with barcode reading

I lost my mind trying to make the focus change automatically between 3 entry field and an "OK" button!
I use a small android device that integrates a barcode reader. I set up the barcode reader to add a "enter key" when barcode is read. That call the OnEnterPressedCommand binded to my viewmodel, then I do some validation and send a message with messaging center to the view code-behind for the focus change.
When I use manually use the "enter" key on the virtual keyboard all work like expected. But when I scan the barcode (with the automatic enter) some focus on fields work, but some never got focus!
Does the virtual enter key work do not do the same thing that hitting adding a enter automatically??

forward inline keyboard along message in telegram

I want to create a message with telegram api that users could share(forward) it along its inline keyboard buttons.
I know with telegram api you can create a message that contains inline keyboard by adding inline_keyboard array in replay_markup of a message but when I forward this message inside telegram just the text part of the message forwards and buttons wont.
In brief I want to know is it possible to create a message with telegram api that when someone forwards this message inline keyboard of that message forwards too.
InlineKeyboardButton with "url" or "login_url" parameter can be forwarded.
Note: if there is another button in keyboard without "url" or "login_url" parameter whole keyboard woudn't be shown
You can't attach inline keyboard in the forwarded message, but you can add a “Share” button, and use switch_inline_query in inline keyboard.
For instance: Users can use #Sean_Bot TeleBot to send a photo with inline buttons, if they want to keep inline buttons, they should click “Share” button instead of directly forward.

Visual indication for inline buttons

Is there a way to show some visual indication that the inline button has been pressed in telegram bot.
I have a bit which send inline keyboard, and when I press each buttons it works perfectly fine, but there is a slight delay in getting response from the server. As there is no visual indication to show if a button has been pressed, it is confusing for uses to know if the button was pressed and end up pressing the same button several times.
there are different types of inline buttons in Telegram:
Opens URL (with url).
Forward a message (with switch_inline_query).
Insert query at the chat (with switch_inline_query_current_chat).
Button with action (with callback_data).
I suppose you are refering to the last type of button, in that case, if a user press a button you will get the callback_data via CallbackQuery, and that lets you modify the original message with editMessageText to add something like:
Button TEST pressed.
As an alternative way, after you got the callback response at your server, you can use Emoji for showing feedback to your users. Just edit the inline message and edit some relative emoji to the button text.

Genexus - Disable Text Block used as button

I have a Text Block that I use as a button (with enter event) and when I press it it takes a while to do what it has to do, so you can click more than once the button and it does it twice or more times. So what I want to do is to disable or to hide the text block while its doing its job, but the text block only hides when it exits the enter event, which is to late because I already could pressed several times the buttom.
How can I find a solution for this? Is there a way to disable or hide the text block when I enter the enter event but before it exit the event?
I suppose you are calling a procedure. Try to use
MyProcedure.Submit()
instead of
MyProcedure.Call()

Oracle Forms - Identify which button was pressed

I have an Oracle form, which when starts has the following activated field.
1. 2 text Item + 2 push button working as LOV button
2. One Button (cancel)
Now for simplicity lets call the text time as text_1 , text_2
Now user has an option to enter any value in text_1 and either press TAB to move to next text item or use mouse pointer to move the cursor to text_2 item OR can press cancel button.
I want to know if the user has pressed TAB or used mouse to press cancel button. Please let me know in case the question is not clear to you.
if user presses tab key, forms generate KEY-NEXT-ITEM trigger. You can type your code there and manage this event. If users presses a button, forms generates WHEN-BUTTON-PRESSED.
Is this right answer to your question? If not, provide a use case, how will programm work from user point of view.
if user presses tab key, forms generate KEY-NEXT-ITEM trigger and post-text-item trigger. Again if user move the cursor using mouse then it only generate post-text-item trigger. If any text item has to fire two trigger then key-next-item fires first.
You can also get triggered item using :SYSTEM.TRIGGER_ITEM.
Thanks
Shamim Ahmed.

Resources