1

I am using java programming to develop a telgram bot. Generally text make monospace which if we click on text its auto get copy to clipboard. How can I make this on telegram bot? I tried to use ` this back quote for this but did not worked.

  • Please provide enough code so others can better understand or reproduce the problem. – Community Jul 17 '22 at 15:18
  • I just asked a feature of telegram bot how can I click a text on that was send from telegram bot it will auto copy to clipboard. Here nothing to add code – Parvez Hossain Jul 18 '22 at 03:44

1 Answers1

1

You can use code html tag to send a message with text that can be copied by clicking on it (works on Android, iOS and even Telegram Desktop).

String messageText = "Click on the text to copy it to clipboard: <code>Hello world!</code>";

Please note that for this to work you have to specify parse_mode="HTML" when sending the message, as specified in the Formatting options section of the Telegram Bot API.

Alternatively, putting the text into backticks with parse_mode="markdown" works as well.

druskacik
  • 2,176
  • 2
  • 13
  • 26