python - Aiogram message formatting - Stack Overflow

I'm developing a telegram bot on aiogram and faced a problem. I need to highlight the text bold it

I'm developing a telegram bot on aiogram and faced a problem. I need to highlight the text bold italicized in the MD V1. How do I do it? I tried different formats: triple underline, triple asterisks, asterisk underline. Nothing helped.

I'm developing a telegram bot on aiogram and faced a problem. I need to highlight the text bold italicized in the MD V1. How do I do it? I tried different formats: triple underline, triple asterisks, asterisk underline. Nothing helped.

Share Improve this question edited Mar 24 at 16:34 AsfhtgkDavid asked Mar 24 at 12:12 AsfhtgkDavidAsfhtgkDavid 499 bronze badges 4
  • Please show us the code you've tried – 0stone0 Commented Mar 24 at 12:14
  • I don't know if it makes sense. It's just reading a message from a .md file and sending it. – AsfhtgkDavid Commented Mar 24 at 12:25
  • Well it's hard for us to guess whats wrong if you don't show the code – 0stone0 Commented Mar 24 at 12:38
  • @0stone0 , I don't think there's a problem with the code. The problem is that I don't know how to make bold italics in Telegram MD syntax. – AsfhtgkDavid Commented Mar 24 at 15:02
Add a comment  | 

1 Answer 1

Reset to default 0

For MarkdownV2, you need *foo* for bold, _bar_ for italic and you can combine them like so:

*_combined _*

Test message:

*bold*
_italic_
*_combined_*

Results in:


If you want to use the AioGram classes, use:

  • aiogram.utils.formatting.Underline
  • aiogram.utils.formatting.Bold
from aiogram.utils.formatting import (
    Bold
)

msg = Bold("Foo Bar")

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744253314a4565271.html

相关推荐

  • python - Aiogram message formatting - Stack Overflow

    I'm developing a telegram bot on aiogram and faced a problem. I need to highlight the text bold it

    8天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信