Recently Telegram has provided the ability to quote texts:
I want to send a message using Telegram Bot API using html
as parse_mode
but I cannot find any mention of how to do it using html tags in official docs.
How is this achievable?
If you want to quote a specific part of a message (for it to appear as a clickable object).
You can modify reply_parameters in method sendMessage.
I didn't manage to build a post request that sends message with such quote, but here is how it looks using Aiogram3:
from config import TOKEN, chat_id, message_id
from aiogram import Bot, types
import asyncio
bot = Bot(token = TOKEN)
asyncio.run(
bot.send_message(
chat_id=chat_id,
text='Quoting the message!',
reply_parameters=types.ReplyParameters(
chat_id=chat_id,
message_id=message_id,
quote='this'
)
)
)
Unfortunatelly, I can't post screenshot to show how it works...
That's my first ever stackoverflow answer 😅
You can also simply format message like as if it has a quote.
If you desire to use HTML formatting, there is a <blockquote>
tag.
This is not a quote
<blockquote>But this is!</blockquote>
Or you can set parse_mode to MarkdownV2 and use the format below:
This is not a quote
> But this is!
That's how it looks with Aiogram3:
from config import TOKEN, chat_id, message_id
from aiogram import Bot, types
import asyncio
bot = Bot(token = TOKEN)
asyncio.run(
bot.send_message(
chat_id=chat_id,
text=(
'This is not a quote\n'
'<blockquote>But this is!</blockquote>'
),
parse_mode='HTML'
)
)